mirror of
https://github.com/flarum/framework.git
synced 2025-02-01 07:03:00 +08:00
Rename to reset and make extension an option
This commit is contained in:
parent
5561e28286
commit
58ffa27bfb
|
@ -14,7 +14,7 @@ namespace Flarum\Console;
|
|||
use Flarum\Console\Event\Configuring;
|
||||
use Flarum\Database\Console\GenerateMigrationCommand;
|
||||
use Flarum\Database\Console\MigrateCommand;
|
||||
use Flarum\Database\Console\RollbackCommand;
|
||||
use Flarum\Database\Console\ResetCommand;
|
||||
use Flarum\Foundation\Application;
|
||||
use Flarum\Foundation\Console\CacheClearCommand;
|
||||
use Flarum\Foundation\Console\InfoCommand;
|
||||
|
@ -59,7 +59,7 @@ class Server
|
|||
$commands = [
|
||||
InstallCommand::class,
|
||||
MigrateCommand::class,
|
||||
RollbackCommand::class,
|
||||
ResetCommand::class,
|
||||
GenerateMigrationCommand::class,
|
||||
];
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ namespace Flarum\Database\Console;
|
|||
|
||||
use Flarum\Console\AbstractCommand;
|
||||
use Flarum\Extension\ExtensionManager;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class RollbackCommand extends AbstractCommand
|
||||
class ResetCommand extends AbstractCommand
|
||||
{
|
||||
/**
|
||||
* @var ExtensionManager
|
||||
|
@ -38,12 +38,13 @@ class RollbackCommand extends AbstractCommand
|
|||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('migrate:rollback')
|
||||
->setDescription('Run rollback migrations for an extension')
|
||||
->addArgument(
|
||||
->setName('migrate:reset')
|
||||
->setDescription('Run all migrations down for an extension')
|
||||
->addOption(
|
||||
'extension',
|
||||
InputArgument::REQUIRED,
|
||||
'The name of the extension.'
|
||||
null,
|
||||
InputOption::VALUE_REQUIRED,
|
||||
'The extension to reset migrations for.'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -52,7 +53,14 @@ class RollbackCommand extends AbstractCommand
|
|||
*/
|
||||
protected function fire()
|
||||
{
|
||||
$extensionName = $this->input->getArgument('extension');
|
||||
$extensionName = $this->input->getOption('extension');
|
||||
|
||||
if (! $extensionName) {
|
||||
$this->info('No extension specified. Please check command syntax.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$extension = $this->manager->getExtension($extensionName);
|
||||
|
||||
if (! $extension) {
|
Loading…
Reference in New Issue
Block a user