/** * Execute the console command. * * @return void */ public function fire() { $this->migrator->setConnection($this->input->getOption('database')); $pretend = $this->input->getOption('pretend'); while ($this->migrator->rollback($this->output, $pretend)) { } }
/** * Execute the console command. * * @return void */ public function fire() { $this->migrator->setConnection($this->input->getOption('database')); $pretend = $this->input->getOption('pretend'); $this->migrator->rollback($pretend); // Once the migrator has run we will grab the note output and send it out to // the console screen, since the migrator itself functions without having // any instances of the OutputInterface contract passed into the class. foreach ($this->migrator->getNotes() as $note) { $this->output->writeln($note); } }
/** * Execute the console command. * * @return mixed */ public function fire() { if (!$this->confirmToProceed()) { return; } $this->migrator->setConnection($this->option('database')); $paths = $this->getMigrationPaths(); $this->migrator->rollback($paths, ['pretend' => $this->option('pretend'), 'step' => (int) $this->option('step')]); foreach ($this->migrator->getNotes() as $note) { $this->output->writeln($note); } }
/** * Execute the console command. * * @return void */ public function fire() { if (!$this->confirmToProceed()) { return; } $this->migrator->setConnection($this->option('database')); $this->migrator->rollback($this->getMigrationPaths(), ['pretend' => $this->option('pretend'), 'step' => (int) $this->option('step')]); // Once the migrator has run we will grab the note output and send it out to // the console screen, since the migrator itself functions without having // any instances of the OutputInterface contract passed into the class. foreach ($this->migrator->getNotes() as $note) { $this->output->writeln($note); } }
/** * @return $this */ public function rollbackModules() { while (true) { $count = $this->migrator->rollback(); foreach ($this->migrator->getNotes() as $note) { $this->output($note); } if ($count == 0) { break; } } return $this; }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); $config = (require __DIR__ . '/../config.php'); $capsule = new Manager(); $capsule->addConnection($config); $capsule->bootEloquent(); Schema::setConnection($capsule->getConnection('default')); DB::setConnection($capsule->getConnection('default')); // run the migrations $migration_repo = new DatabaseMigrationRepository(Model::getConnectionResolver(), 'migrations'); if (!$migration_repo->repositoryExists()) { $migration_repo->createRepository(); } $migrator = new Migrator($migration_repo, Model::getConnectionResolver(), new Filesystem()); $migrator->rollback(); $migrator->run(__DIR__ . '/../../src/migrations'); static::loadFixtures(); }
/** * @return $this */ public function resetModules() { $this->output('Starting process of reseting...'); foreach ($this->_modules as $module) { $this->resetModule($module); } /* * Rollback modules */ while (true) { $count = $this->_migrator->rollback(); foreach ($this->_migrator->getNotes() as $note) { $this->output($note); } if ($count == 0) { break; } } return $this; }
/** * Rollback the last migration operation. Overridden from parent to allow loading of files from the appropriate paths * * @param bool $pretend * @return int */ public function rollback($pretend = false) { $migrations = $this->repository->getLast(); $this->requireFilesFromMigrations($migrations); parent::rollback($pretend); }
/** * Rollback the last migration operation. * * @param array|string $paths * @param array $options * @return array */ public function rollback($paths = [], array $options = []) { $this->repository->setAddon($this->getAddon()); return parent::rollback($paths, $options); }