Forgot to CTRL+S this file, oops!

This commit is contained in:
flash 2023-01-01 03:50:41 +00:00
parent 9efe8e6853
commit cd959b7e55

View file

@ -15,18 +15,21 @@ class MigrateCommand implements CommandInterface {
}
public function dispatch(CommandArgs $args): void {
if($args->getArg(0) === 'rollback') {
echo 'Migration rollback is gone.' . PHP_EOL;
return;
}
touch(MSZ_ROOT . '/.migrating');
chmod(MSZ_ROOT . '/.migrating', 0777);
echo "Creating migration manager.." . PHP_EOL;
$migrationManager = new DatabaseMigrationManager(DB::getPDO(), MSZ_ROOT . '/database');
$migrationManager->setLogger(function ($log) {
echo $log . PHP_EOL;
});
try {
echo "Creating migration manager.." . PHP_EOL;
$migrationManager = new DatabaseMigrationManager(DB::getPDO(), MSZ_ROOT . '/database');
$migrationManager->setLogger(function ($log) {
echo $log . PHP_EOL;
});
if($args->getArg(0) === 'rollback') {
echo 'Migration rollback is gone.' . PHP_EOL;
} else {
$migrationManager->migrate();
$errors = $migrationManager->getErrors();
@ -39,8 +42,8 @@ class MigrateCommand implements CommandInterface {
foreach($errors as $error)
echo $error . PHP_EOL;
}
} finally {
unlink(MSZ_ROOT . '/.migrating');
}
unlink(MSZ_ROOT . '/.migrating');
}
}