From cb90f5f6d318a810b984c97825873491458dfb7e Mon Sep 17 00:00:00 2001 From: yanwenwu Date: Thu, 23 Jan 2020 13:18:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9migration=20rollback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/command/MigrateRollbackCommand.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/extend/catcher/command/MigrateRollbackCommand.php b/extend/catcher/command/MigrateRollbackCommand.php index acfe469..64e260e 100644 --- a/extend/catcher/command/MigrateRollbackCommand.php +++ b/extend/catcher/command/MigrateRollbackCommand.php @@ -105,9 +105,13 @@ EOT $versionLog = $this->getVersionLog(); $versions = array_keys($versionLog); - foreach ($migrations as $key => $migration) { - if (in_array($key, $versions)) { - $this->executeMigration($migration, MigrationInterface::DOWN); + if ($version) { + $this->executeMigration($migrations[$version], MigrationInterface::DOWN); + } else { + foreach ($migrations as $key => $migration) { + if (in_array($key, $versions)) { + $this->executeMigration($migration, MigrationInterface::DOWN); + } } } }