芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/www/cloud.pulsehost.co.uk/system/Console/Commands/Migrations/RollbackCommand.php
migrator = $migrator; } protected function configure(): void { $this->setName('migrate:rollback') ->setDescription('Rollback the last database migration') ->addOption('database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use') ->addOption('force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production') ->addOption('path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed') ->addOption('realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths') ->addOption('pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run') ->addOption('step', null, InputOption::VALUE_OPTIONAL, 'The number of migrations to be reverted'); } /** * Execute the console command. * * @return int */ protected function execute(InputInterface $input, OutputInterface $output): int { $defaultAnswer = $input->getOption('no-interaction'); $helper = $this->getHelper('question'); $question = new ConfirmationQuestion('Do you really wish to run this command? (Y/N)', $defaultAnswer); if (!$helper->ask($input, $output, $question)) { return Command::SUCCESS; } $this->migrator->usingConnection($input->getOption('database'), function () use ($input, $output) { $this->migrator->setOutput($output)->rollback( $this->getMigrationPaths($input), [ 'pretend' => $input->getOption('pretend'), 'step' => (int) $input->getOption('step'), ] ); }); return Command::SUCCESS; } }