示例#1
0
 public function includeMigrations($path)
 {
     $migrationsFileList = array();
     $configuredMigrations = $this->manager->getTenantMigrations();
     $availableMigrations = $this->getMigrationFiles($path);
     foreach ($availableMigrations as $migration) {
         $migrationName = $this->tenantMigrationResolver->resolveMigrationName($migration);
         if ($this->manager->getMigrationBehavior() == 'only') {
             if (in_array($migrationName, $configuredMigrations)) {
                 $migrationsFileList[] = $migration;
             }
         } else {
             if (in_array($migrationName, $configuredMigrations) == false) {
                 $migrationsFileList[] = $migration;
             }
         }
     }
     $this->requireFiles($path, $migrationsFileList);
     return $migrationsFileList;
 }
示例#2
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if ($this->manager->getMigrationBehavior() == 'only') {
         foreach ($this->manager->getTenantMigrations() as $migrationName) {
             $this->info($migrationName);
         }
     } else {
         // This bit of code will get all of the migrations from the file system and load them into
         // an array. After the migration files are in the array, we will get the actual class name
         // from the migration file.
         $path = $this->getMigrationPath();
         $files = $this->migrator->getMigrationFiles($path);
         $migrations = array();
         foreach ($files as $file) {
             $migrations[] = $this->tenantMigrationResolver->resolveMigrationName($file);
         }
         $migrations = array_diff($migrations, $this->manager->getTenantMigrations());
         foreach ($migrations as $migrationName) {
             $this->info($migrationName);
         }
     }
 }