/** * Create date folder structure and move migrations into. * * @return void */ public function fire() { $this->basePath = $this->getMigrationPath(); $migrations = $this->migrator->getMigrationFiles($this->basePath); $count = count($migrations); if ($count == 0) { $this->comment('No migrations to move'); return; } foreach ($migrations as $migration) { $datePath = $this->migrator->getDateFolderStructure($migration); // Move the migration into base migration folder $this->files->move($this->basePath . '/' . $datePath . $migration . '.php', $this->basePath . '/' . $migration . '.php'); } $this->info('Migrations disorganised successfully (' . $count . ' migrations moved)'); $this->cleanup(); }
/** * Create date folder structure and move migrations into. * * @return void */ public function fire() { $basePath = $this->getMigrationPath(); $migrations = $this->migrator->getMigrationFiles($basePath, false); $count = count($migrations); if ($count == 0) { $this->comment('No migrations to move'); return; } foreach ($migrations as $migration) { $datePath = $this->migrator->getDateFolderStructure($migration); // Create folder if it does not already exist if (!$this->files->exists($basePath . '/' . $datePath)) { $this->files->makeDirectory($basePath . '/' . $datePath, 0775, true); } // Move the migration into its new folder $this->files->move($basePath . '/' . $migration . '.php', $basePath . '/' . $datePath . $migration . '.php'); } $this->info('Migrations organised successfully (' . $count . ' migrations moved)'); }