/** * Show new migrations. * * @return void */ protected function showNewMigrations() { $new = collect($this->migrator->getMigrationsToRun()); $this->output->writeln("<fg=green>New migrations:\r\n</>"); foreach ($new as $migration) { $this->output->writeln("<fg=green>{$migration}.php</>"); } }
/** * Execute the console command. * * @return null|int */ protected function fire() { $toRun = $this->migrator->getMigrationsToRun(); if (!empty($toRun)) { foreach ($toRun as $migration) { $this->migrator->runMigration($migration); $this->message("<info>Migrated:</info> {$migration}.php"); } } else { $this->info('Nothing to migrate'); } }
/** * Delete migration file if options is set * * @param string $migration * * @return null */ protected function deleteIfNeeded($migration) { if (!$this->input->getOption('delete')) { return; } if ($this->migrator->deleteMigrationFile($migration)) { $this->message("<info>Deleted:</info> {$migration}.php"); } }
/** * Execute the console command. * * @return null|int */ protected function fire() { $migration = $this->migrator->createMigration($this->input->getArgument('name'), $this->input->getOption('template')); $this->message("<info>Migration created:</info> {$migration}.php"); }