Ejemplo n.º 1
0
 public function resolve($file)
 {
     /* @var $class \Consolet\Migrator\Migration */
     $class = parent::resolve($file);
     $class::setSchemaOnce($this->resolveConnection(null)->getSchemaBuilder());
     return $class;
 }
Ejemplo n.º 2
0
 /**
  * Resolve a migration instance from a file.
  *
  * @param  string $file
  *
  * @return Migration
  */
 public function resolve($file)
 {
     $this->requireOnce($file);
     if (!str_is('*.*.*', $file)) {
         return parent::resolve($file);
     }
     return app($this->dispatch(new TransformMigrationNameToClass($this->removeDatePrefix($file))));
 }
Ejemplo n.º 3
0
 /**
  * Reset the migrations for the extension with an
  * optional customized path.
  *
  * @param  string  $path
  * @return void
  */
 protected function resetMigrations($path = null)
 {
     if (!isset(static::$migrator)) {
         return;
     }
     $path = $path ?: $this->getMigrationsPath();
     $files = static::$migrator->getMigrationFiles($path);
     $repository = static::$migrator->getRepository();
     // Get an array of migration names which will be
     // reset
     $migrations = array_intersect(array_reverse($repository->getRan()), $files);
     // Loop through the migrations we have to rollback
     foreach ($migrations as $migration) {
         // Let the migrator resolve the migration instance
         $instance = static::$migrator->resolve($migration);
         // And we'll call the down method on the migration
         $instance->down();
         // Now we need to manipulate what the migrator does to
         // delete a migration.
         $migrationClass = new \StdClass();
         $migrationClass->migration = $migration;
         $repository->delete($migrationClass);
     }
 }