Add migrate command to manually upgrade db, incase auto migrate is disabled

This commit is contained in:
slawkens
2024-11-08 10:50:47 +01:00
parent 92024cfdbf
commit dead8e4043
3 changed files with 42 additions and 5 deletions

View File

@@ -0,0 +1,28 @@
<?php
namespace MyAAC\Commands;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
class MigrateCommand extends Command
{
protected function configure(): void
{
$this->setName('migrate')
->setDescription('This command updates the AAC to latest migration');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
require SYSTEM . 'init.php';
$io = new SymfonyStyle($input, $output);
require SYSTEM . 'migrate.php';
$io->success('Migrated to latest version');
return Command::SUCCESS;
}
}