console\controllers\BaseMigrateController migrateToTime()

migrateToTime() protected method Migrates to the specified apply time in the past. protected void migrateToTime ( $time )$time integer UNIX timestamp value.

console\controllers\BaseMigrateController migrateDown()

migrateDown() protected method Downgrades with the specified migration class. protected boolean migrateDown ( $class )$class string The migration class name return boolean Whether the migration is successful

console\controllers\BaseMigrateController getNewMigrations()

getNewMigrations() protected method Returns the migrations that are not applied. protected array getNewMigrations ( )return array List of new migrations

console\controllers\BaseMigrateController getMigrationHistory()

getMigrationHistory() protected abstract method Returns the migration history. protected abstract array getMigrationHistory ( $limit )$limit integer The maximum number of records in the history to be returned. null for "no limit". return array The migration history

console\controllers\BaseMigrateController generateMigrationSourceCode()

generateMigrationSourceCode() protected method (available since version 2.0.8) Generates new migration source PHP code. Child class may override this method, adding extra logic or variation to the process. protected string generateMigrationSourceCode ( $params )$params array Generation parameters, usually following parameters are present: name: string migration base name className: string migration class name return string Generated PHP code.

console\controllers\BaseMigrateController createMigration()

createMigration() protected method Creates a new migration instance. protected yii\db\MigrationInterface createMigration ( $class )$class string The migration class name return yii\db\MigrationInterface The migration instance

console\controllers\BaseMigrateController beforeAction()

beforeAction() public method This method is invoked right before an action is to be executed (after all possible filters.) It checks the existence of the $migrationPath. public boolean beforeAction ( $action )$action yii\base\Action The action to be executed. return boolean Whether the action should continue to be executed. throws yii\base\InvalidConfigException if directory specified in migrationPath doesn't exist and action isn't "create".

console\controllers\BaseMigrateController addMigrationHistory()

addMigrationHistory() protected abstract method Adds new migration entry to the history. protected abstract void addMigrationHistory ( $version )$version string Migration version name.

console\controllers\BaseMigrateController actionUp()

actionUp() public method Upgrades the application by applying new migrations. For example, yii migrate # apply all new migrations yii migrate 3 # apply the first 3 new migrations public integer actionUp ( $limit = 0 )$limit integer The number of new migrations to be applied. If 0, it means applying all available new migrations. return integer The status of the action execution. 0 means normal, other values mean abnormal.

console\controllers\BaseMigrateController actionTo()

actionTo() public method Upgrades or downgrades till the specified version. Can also downgrade versions to the certain apply time in the past by providing a UNIX timestamp or a string parseable by the strtotime() function. This means that all the versions applied after the specified certain time would be reverted. This command will first revert the specified migrations, and then apply them again. For example, yii migrate/to 101129_185401 # using timestamp yii migrat