Forgot to CTRL+S this file, oops!
This commit is contained in:
parent
9efe8e6853
commit
cd959b7e55
1 changed files with 13 additions and 10 deletions
|
@ -15,18 +15,21 @@ class MigrateCommand implements CommandInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dispatch(CommandArgs $args): void {
|
public function dispatch(CommandArgs $args): void {
|
||||||
|
if($args->getArg(0) === 'rollback') {
|
||||||
|
echo 'Migration rollback is gone.' . PHP_EOL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
touch(MSZ_ROOT . '/.migrating');
|
touch(MSZ_ROOT . '/.migrating');
|
||||||
chmod(MSZ_ROOT . '/.migrating', 0777);
|
chmod(MSZ_ROOT . '/.migrating', 0777);
|
||||||
|
|
||||||
echo "Creating migration manager.." . PHP_EOL;
|
try {
|
||||||
$migrationManager = new DatabaseMigrationManager(DB::getPDO(), MSZ_ROOT . '/database');
|
echo "Creating migration manager.." . PHP_EOL;
|
||||||
$migrationManager->setLogger(function ($log) {
|
$migrationManager = new DatabaseMigrationManager(DB::getPDO(), MSZ_ROOT . '/database');
|
||||||
echo $log . PHP_EOL;
|
$migrationManager->setLogger(function ($log) {
|
||||||
});
|
echo $log . PHP_EOL;
|
||||||
|
});
|
||||||
|
|
||||||
if($args->getArg(0) === 'rollback') {
|
|
||||||
echo 'Migration rollback is gone.' . PHP_EOL;
|
|
||||||
} else {
|
|
||||||
$migrationManager->migrate();
|
$migrationManager->migrate();
|
||||||
|
|
||||||
$errors = $migrationManager->getErrors();
|
$errors = $migrationManager->getErrors();
|
||||||
|
@ -39,8 +42,8 @@ class MigrateCommand implements CommandInterface {
|
||||||
foreach($errors as $error)
|
foreach($errors as $error)
|
||||||
echo $error . PHP_EOL;
|
echo $error . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
unlink(MSZ_ROOT . '/.migrating');
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink(MSZ_ROOT . '/.migrating');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue