mirror of
https://github.com/flarum/framework.git
synced 2025-02-08 07:15:14 +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\Console\Event\Configuring;
|
||||||
use Flarum\Database\Console\GenerateMigrationCommand;
|
use Flarum\Database\Console\GenerateMigrationCommand;
|
||||||
use Flarum\Database\Console\MigrateCommand;
|
use Flarum\Database\Console\MigrateCommand;
|
||||||
use Flarum\Database\Console\RollbackCommand;
|
use Flarum\Database\Console\ResetCommand;
|
||||||
use Flarum\Foundation\Application;
|
use Flarum\Foundation\Application;
|
||||||
use Flarum\Foundation\Console\CacheClearCommand;
|
use Flarum\Foundation\Console\CacheClearCommand;
|
||||||
use Flarum\Foundation\Console\InfoCommand;
|
use Flarum\Foundation\Console\InfoCommand;
|
||||||
|
@ -59,7 +59,7 @@ class Server
|
||||||
$commands = [
|
$commands = [
|
||||||
InstallCommand::class,
|
InstallCommand::class,
|
||||||
MigrateCommand::class,
|
MigrateCommand::class,
|
||||||
RollbackCommand::class,
|
ResetCommand::class,
|
||||||
GenerateMigrationCommand::class,
|
GenerateMigrationCommand::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ namespace Flarum\Database\Console;
|
||||||
|
|
||||||
use Flarum\Console\AbstractCommand;
|
use Flarum\Console\AbstractCommand;
|
||||||
use Flarum\Extension\ExtensionManager;
|
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
|
* @var ExtensionManager
|
||||||
|
@ -38,12 +38,13 @@ class RollbackCommand extends AbstractCommand
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->setName('migrate:rollback')
|
->setName('migrate:reset')
|
||||||
->setDescription('Run rollback migrations for an extension')
|
->setDescription('Run all migrations down for an extension')
|
||||||
->addArgument(
|
->addOption(
|
||||||
'extension',
|
'extension',
|
||||||
InputArgument::REQUIRED,
|
null,
|
||||||
'The name of the extension.'
|
InputOption::VALUE_REQUIRED,
|
||||||
|
'The extension to reset migrations for.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +53,14 @@ class RollbackCommand extends AbstractCommand
|
||||||
*/
|
*/
|
||||||
protected function fire()
|
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);
|
$extension = $this->manager->getExtension($extensionName);
|
||||||
|
|
||||||
if (! $extension) {
|
if (! $extension) {
|
Loading…
Reference in New Issue
Block a user