/** * Execute the console command. * * @param ConfigurationProvider $provider * @param Migrator $migrator */ public function fire(ConfigurationProvider $provider, Migrator $migrator) { if (!$this->confirmToProceed()) { return; } $configuration = $provider->getForConnection($this->option('connection')); $version = $this->argument('version'); $direction = $this->option('down') ? 'down' : 'up'; $version = $configuration->getVersion($version); if ($path = $this->option('write-sql')) { $migrator->executeToFile($version, $direction, $path); } else { $migrator->execute($version, $direction, $this->option('dry-run'), $this->option('query-time')); } foreach ($migrator->getNotes() as $note) { $this->line($note); } }