addOption('seed', null, InputOption::VALUE_NONE, 'Indicates if the seed command should be re-run'); } protected function execute(InputInterface $input, OutputInterface $output): int { $output->writeln('Iniciando limpeza do banco de dados (fresh)...'); // 1. Wipe database $wipeCommand = $this->getApplication()->find('db:wipe'); $wipeInput = new ArrayInput(['--force' => true]); $wipeCommand->run($wipeInput, $output); // 2. Run migrations $migrateCommand = $this->getApplication()->find('migrate'); $migrateInput = new ArrayInput([]); $migrateCommand->run($migrateInput, $output); // 3. Optional seed if ($input->getOption('seed')) { $seedCommand = $this->getApplication()->find('db:seed'); $seedInput = new ArrayInput([]); $seedCommand->run($seedInput, $output); } $output->writeln('Operação migrate:fresh concluída com sucesso!'); return Command::SUCCESS; } }