Maintaining Backward Compatibility¶
If you need to maintain the old command structure for existing scripts or CI/CD
pipelines, you can add command aliases in your application. In your
src/Application.php file, add the following to the console() method:
public function console(CommandCollection $commands): CommandCollection
{
// Add your application's commands
$commands = $this->addConsoleCommands($commands);
// Add backward compatibility aliases for migrations 4.x commands
$commands->add('migrations seed', \Migrations\Command\SeedCommand::class);
return $commands;
}
For multiple aliases, you can add them all together:
// Add multiple backward compatibility aliases
$commands->add('migrations seed', \Migrations\Command\SeedCommand::class);
$commands->add('migrations seed:run', \Migrations\Command\SeedCommand::class);
$commands->add('migrations seed:status', \Migrations\Command\SeedStatusCommand::class);
This allows gradual migration of scripts and documentation without modifying the migrations plugin or creating wrapper command classes.