Exemplo n.º 1
0
 /**
  * Run an array of migrations.
  *
  * @param  array  $migrations
  * @param  array  $options
  * @return void
  */
 public function runMigrationList($migrations, array $options = [])
 {
     // First we will just make sure that there are any migrations to run. If there
     // aren't, we will just make a note of it to the developer so they're aware
     // that all of the migrations have been run against this database system.
     if (count($migrations) == 0) {
         $this->note('<info>Nothing to migrate.</info>');
         return;
     }
     $batch = $this->repository->getNextBatchNumber();
     $pretend = Arr::get($options, 'pretend', false);
     $step = Arr::get($options, 'step', false);
     // Once we have the array of migrations, we will spin through them and run the
     // migrations "up" so the changes are made to the databases. We'll then log
     // that the migration was run so we don't repeat it next time we execute.
     foreach ($migrations as $file) {
         $this->runUp($file, $batch, $pretend);
         // If we are stepping through the migrations, then we will increment the
         // batch value for each individual migration that is run. That way we
         // can run "artisan migrate:rollback" and undo them one at a time.
         if ($step) {
             $batch++;
         }
     }
 }