Framework/src/commands/migrate.php

26 lines
919 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 = 'migrate';
protected string $description = 'Run the database migrations';
public function handle(Input $input, Output $output): int
{
$output->writeln('<info>Running migrations...</info>');
// In a real implementation, we would get the manager from the DI container.
// For now, we simulate integration with PairityConnection.
$connection = new \Phred\Orm\PairityConnection();
$manager = $connection->getManager();
$result = $manager->migrate();
$output->writeln($result);
$output->writeln('<info>Migrations completed successfully.</info>');
return 0;
}
};