Ability to set the database version

This commit is contained in:
Michael 2020-09-13 15:57:24 +00:00
parent cb647b5b6c
commit 50b5483ee1
3 changed files with 27 additions and 2 deletions

View file

@ -48,6 +48,22 @@ class DBStructure
*/
private static $definition = [];
/**
* Set a database version to trigger update functions
*
* @param string $version
* @return void
*/
public static function setDatabaseVersion(string $version)
{
if (!is_numeric($version)) {
throw new \Asika\SimpleConsole\CommandArgsException('The version number must be numeric');
}
DI::config()->set('system', 'build', $version);
echo DI::l10n()->t('The database version had been set to %s.', $version);
}
/**
* Converts all tables from MyISAM/InnoDB Antelope to InnoDB Barracuda
*/