|
|
|
@ -124,14 +124,19 @@ abstract class BaseMigrateController extends Controller
|
|
|
|
|
} |
|
|
|
|
$this->stdout("\n"); |
|
|
|
|
|
|
|
|
|
$applied = 0; |
|
|
|
|
if ($this->confirm('Apply the above ' . ($n === 1 ? 'migration' : 'migrations') . '?')) { |
|
|
|
|
foreach ($migrations as $migration) { |
|
|
|
|
if (!$this->migrateUp($migration)) { |
|
|
|
|
$this->stdout("\n$applied from $n " . ($applied === 1 ? 'migration was' : 'migrations were') ." applied.\n", Console::FG_RED); |
|
|
|
|
$this->stdout("\nMigration failed. The rest of the migrations are canceled.\n", Console::FG_RED); |
|
|
|
|
|
|
|
|
|
return self::EXIT_CODE_ERROR; |
|
|
|
|
} |
|
|
|
|
$applied++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$this->stdout("\n$n " . ($n === 1 ? 'migration was' : 'migrations were') ." applied.\n", Console::FG_GREEN); |
|
|
|
|
$this->stdout("\nMigrated up successfully.\n", Console::FG_GREEN); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -180,14 +185,18 @@ abstract class BaseMigrateController extends Controller
|
|
|
|
|
} |
|
|
|
|
$this->stdout("\n"); |
|
|
|
|
|
|
|
|
|
$reverted = 0; |
|
|
|
|
if ($this->confirm('Revert the above ' . ($n === 1 ? 'migration' : 'migrations') . '?')) { |
|
|
|
|
foreach ($migrations as $migration) { |
|
|
|
|
if (!$this->migrateDown($migration)) { |
|
|
|
|
$this->stdout("\n$reverted from $n " . ($reverted === 1 ? 'migration was' : 'migrations were') ." reverted.\n", Console::FG_RED); |
|
|
|
|
$this->stdout("\nMigration failed. The rest of the migrations are canceled.\n", Console::FG_RED); |
|
|
|
|
|
|
|
|
|
return self::EXIT_CODE_ERROR; |
|
|
|
|
} |
|
|
|
|
$reverted++; |
|
|
|
|
} |
|
|
|
|
$this->stdout("\n$n " . ($n === 1 ? 'migration was' : 'migrations were') ." reverted.\n", Console::FG_GREEN); |
|
|
|
|
$this->stdout("\nMigrated down successfully.\n", Console::FG_GREEN); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -253,6 +262,7 @@ abstract class BaseMigrateController extends Controller
|
|
|
|
|
return self::EXIT_CODE_ERROR; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$this->stdout("\n$n " . ($n === 1 ? 'migration was' : 'migrations were') ." redone.\n", Console::FG_GREEN); |
|
|
|
|
$this->stdout("\nMigration redone successfully.\n", Console::FG_GREEN); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|