src/Console/Controllers/BaseMigrateController.php
public function actionMark(RequestApplicationInterface $app, $version)
    {
        $originalVersion = $version;
        if (($namespaceVersion = $this->extractNamespaceMigrationVersion($version)) !== false) {
            $version = $namespaceVersion;
        } elseif (($migrationName = $this->extractMigrationVersion($version)) !== false) {
            $version = $migrationName;
        } 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).");
        }

        // try mark up
        return $this->getNewMigrations()->then(
            function($migrations = []) use ($version, $originalVersion) {
                foreach ($migrations as $i => $migration) {
                    if (strpos($migration, $version) === 0) {
                        if ($this->confirm("Set migration history at $originalVersion?")) {
                            for ($j = 0; $j <= $i; ++$j) {
                                $this->addMigrationHistory($migrations[$j]);
                            }
                            $this->stdout("The migration history is set at $originalVersion.\nNo actual migration was performed.\n", Console::FG_GREEN);
                        }

                        return true;
                    }
                }
                return false;
            }
        )->then(
            function($prevResult = false) use ($version, $originalVersion) {
                if ($prevResult) {
                    return true;
                }
                // try mark down
                return $this->getMigrationHistory(null)->then(
                    function($migrations = []) use ($version, $originalVersion) {
                        $migrations = array_keys($migrations);
                        $migrations[] = static::BASE_MIGRATION;
                        foreach ($migrations as $i => $migration) {
                            if (strpos($migration, $version) === 0) {
                                if ($i === 0) {
                                    $this->stdout("Already at '$originalVersion'. Nothing needs to be done.\n", Console::FG_YELLOW);
                                    return resolve(true);
                                } else {
                                    return $this->confirm("Set migration history at $originalVersion?")->then(
                                        function() use ($migrations, $i, $originalVersion) {
                                            for ($j = 0; $j < $i; ++$j) {
                                                $this->removeMigrationHistory($migrations[$j]);
                                            }
                                            $this->stdout("The migration history is set at $originalVersion.\nNo actual migration was performed.\n", Console::FG_GREEN);
                                        }
                                    );
                                }
                            }
                        }
                        return reject(false);
                    }
                );
            }
        )->then(null, function($error = null) use ($originalVersion) {
            $prevException = $error instanceof \Throwable ? $error : null;
            $exception = new Exception("Unable to find the version '$originalVersion'.", 0, $prevException);
            throw $exception;
        });
    }
public function actionMark(RequestApplicationInterface $app, $version)
    {
        $originalVersion = $version;
        if (($namespaceVersion = $this->extractNamespaceMigrationVersion($version)) !== false) {
            $version = $namespaceVersion;
        } elseif (($migrationName = $this->extractMigrationVersion($version)) !== false) {
            $version = $migrationName;
        } 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).");
        }

        // try mark up
        return $this->getNewMigrations()->then(
            function($migrations = []) use ($version, $originalVersion) {
                foreach ($migrations as $i => $migration) {
                    if (strpos($migration, $version) === 0) {
                        if ($this->confirm("Set migration history at $originalVersion?")) {
                            for ($j = 0; $j <= $i; ++$j) {
                                $this->addMigrationHistory($migrations[$j]);
                            }
                            $this->stdout("The migration history is set at $originalVersion.\nNo actual migration was performed.\n", Console::FG_GREEN);
                        }

                        return true;
                    }
                }
                return false;
            }
        )->then(
            function($prevResult = false) use ($version, $originalVersion) {
                if ($prevResult) {
                    return true;
                }
                // try mark down
                return $this->getMigrationHistory(null)->then(
                    function($migrations = []) use ($version, $originalVersion) {
                        $migrations = array_keys($migrations);
                        $migrations[] = static::BASE_MIGRATION;
                        foreach ($migrations as $i => $migration) {
                            if (strpos($migration, $version) === 0) {
                                if ($i === 0) {
                                    $this->stdout("Already at '$originalVersion'. Nothing needs to be done.\n", Console::FG_YELLOW);
                                    return resolve(true);
                                } else {
                                    return $this->confirm("Set migration history at $originalVersion?")->then(
                                        function() use ($migrations, $i, $originalVersion) {
                                            for ($j = 0; $j < $i; ++$j) {
                                                $this->removeMigrationHistory($migrations[$j]);
                                            }
                                            $this->stdout("The migration history is set at $originalVersion.\nNo actual migration was performed.\n", Console::FG_GREEN);
                                        }
                                    );
                                }
                            }
                        }
                        return reject(false);
                    }
                );
            }
        )->then(null, function($error = null) use ($originalVersion) {
            $prevException = $error instanceof \Throwable ? $error : null;
            $exception = new Exception("Unable to find the version '$originalVersion'.", 0, $prevException);
            throw $exception;
        });
    }
Modifies the migration history to the specified version.

No actual migration will be performed.

```
console migrate/mark 101129_185401                        # using timestamp
console migrate/mark m101129_185401_create_user_table     # using full name
console migrate/mark app\migrations\M101129185401CreateUser # using full namespace name
console migrate/mark m000000_000000_base # reset the complete migration history
```

@param RequestApplicationInterface $app
@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 ExtendedPromiseInterface
@throws Exception if the version argument is invalid or the version cannot be found.