Refit october:down

This commit is contained in:
Samuel Georges 2017-05-13 20:43:44 +10:00
parent f3aad33e5e
commit 8a95fec188
1 changed files with 15 additions and 4 deletions

View File

@ -81,6 +81,16 @@ class UpdateManager
*/
protected $productCache;
/**
* @var Illuminate\Database\Migrations\Migrator
*/
protected $migrator;
/**
* @var Illuminate\Database\Migrations\DatabaseMigrationRepository
*/
protected $repository;
/**
* Initialize this singleton.
*/
@ -316,23 +326,24 @@ class UpdateManager
/*
* Register module migration files
*/
$paths = [];
$modules = Config::get('cms.loadModules', []);
foreach ($modules as $module) {
$path = base_path() . '/modules/'.strtolower($module).'/database/migrations';
$this->migrator->requireFiles($path, $this->migrator->getMigrationFiles($path));
$paths[] = $path = base_path() . '/modules/'.strtolower($module).'/database/migrations';
}
/*
* Rollback modules
*/
while (true) {
$count = $this->migrator->rollback();
$rolledBack = $this->migrator->rollback($paths, ['pretend' => false]);
foreach ($this->migrator->getNotes() as $note) {
$this->note($note);
}
if ($count == 0) {
if (count($rolledBack) == 0) {
break;
}
}