/** * Run "down" a migration instance. * * @param Symfony\Component\Console\Output\OutputInterface $output * @param StdClass $migration * @param bool $pretend * @return void */ protected function runDown($output, $migration, $pretend) { $file = $migration->migration; // First we will get the file name of the migration so we can resolve out an // instance of the migration. Once we get an instance we can either run a // pretend execution of the migration or we can run the real migration. $instance = $this->resolve($file); if ($pretend) { return $this->pretendToRun($output, $instance, 'down'); } $instance->down(); // Once we have successfully run the migration "down" we will remove it from // the migration repository so it will be considered to have not been run // by the application then will be able to fire by any later operation. $this->repository->delete($migration); $output->writeln("<info>Rolled back:</info> {$file}"); }