24 lines
790 B
PHP
24 lines
790 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
use Phred\Console\Command;
|
|
use Symfony\Component\Console\Input\InputInterface as Input;
|
|
use Symfony\Component\Console\Output\OutputInterface as Output;
|
|
use Pairity\Manager;
|
|
return new class extends Command {
|
|
protected string $command = 'migration:rollback';
|
|
protected string $description = 'Rollback the last database migration';
|
|
public function handle(Input $input, Output $output): int
|
|
{
|
|
$output->writeln('<info>Rolling back migrations...</info>');
|
|
|
|
$connection = new \Phred\Orm\PairityConnection();
|
|
$manager = $connection->getManager();
|
|
$result = $manager->rollback();
|
|
|
|
$output->writeln($result);
|
|
$output->writeln('<info>Rollback completed successfully.</info>');
|
|
|
|
return 0;
|
|
}
|
|
};
|