mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-13 22:06:51 +08:00
@ -366,11 +366,14 @@ abstract class BaseMigrateController extends Controller
|
||||
* ```
|
||||
* yii migrate/mark 101129_185401 # using timestamp
|
||||
* yii migrate/mark m101129_185401_create_user_table # using full name
|
||||
* yii migrate/to app\migrations\M101129185401CreateUser # using full namespace name
|
||||
* yii migrate/mark app\migrations\M101129185401CreateUser # using full namespace name
|
||||
* yii migrate/mark m000000_000000_base # reset the complete migration history
|
||||
* ```
|
||||
*
|
||||
* @param string $version the version at which the migration history should be marked.
|
||||
* This can be either the timestamp or the full name of the migration.
|
||||
* You may specify the name `m000000_000000_base` to set the migration history to a
|
||||
* state where no migration has been applied.
|
||||
* @return int CLI exit code
|
||||
* @throws Exception if the version argument is invalid or the version cannot be found.
|
||||
*/
|
||||
@ -381,7 +384,7 @@ abstract class BaseMigrateController extends Controller
|
||||
$version = $namespaceVersion;
|
||||
} elseif (($migrationName = $this->extractMigrationVersion($version)) !== false) {
|
||||
$version = $migrationName;
|
||||
} else {
|
||||
} elseif ($version !== static::BASE_MIGRATION) {
|
||||
throw new Exception("The version argument must be either a timestamp (e.g. 101129_185401)\nor the full name of a migration (e.g. m101129_185401_create_user_table)\nor the full name of a namespaced migration (e.g. app\\migrations\\M101129185401CreateUserTable).");
|
||||
}
|
||||
|
||||
@ -402,6 +405,7 @@ abstract class BaseMigrateController extends Controller
|
||||
|
||||
// try mark down
|
||||
$migrations = array_keys($this->getMigrationHistory(null));
|
||||
$migrations[] = static::BASE_MIGRATION;
|
||||
foreach ($migrations as $i => $migration) {
|
||||
if (strpos($migration, $version) === 0) {
|
||||
if ($i === 0) {
|
||||
|
Reference in New Issue
Block a user