Property | Type | Description | |
---|---|---|---|
$db | the DB connection object or the application component ID of the DB connection. | ||
$defaultAction | the default command action. | ||
$disableLookup | lookup all application migration paths | ||
$interactive | whether to execute the migration in an interactive mode. | ||
$migrationLookup | additional aliases of migration directories | ||
$migrationPath | the directory storing the migration classes. This can be either a path alias or a directory. | ||
$migrationTable | the name of the table for keeping applied migration information. | ||
$templateFile | the template file for generating new migrations. This can be either a path alias (e.g. "@app/migrations/template.php") or a file path. |
Method | Description | |
---|---|---|
actionCreate ( string $name ) | Creates a new migration. | |
actionDown ( integer $limit = 1 ) | Downgrades the application by reverting old migrations. | |
actionHistory ( integer $limit = 10 ) | Displays the migration history. | |
actionMark ( string $version ) | Modifies the migration history to the specified version. | |
actionNew ( integer $limit = 10 ) | Displays the un-applied new migrations. | |
actionRedo ( integer $limit = 1 ) | Redoes the last few migrations. | |
actionTo ( string $version ) | Upgrades or downgrades till the specified version. | |
actionUp ( integer $limit ) | Upgrades the application by applying new migrations. | |
beforeAction ( |
This method is invoked right before an action is to be executed (after all possible filters.) It checks the existence of the [[migrationPath]]. | |
options ( $actionId ) |
Method | Description | |
---|---|---|
createMigration ( string $class, $alias ) : |
Creates a new migration instance. | |
createMigrationHistoryTable ( ) | Creates the migration history table. | |
getMigrationHistory ( integer $limit ) : array | Returns the migration history. | |
getNewMigrations ( ) : array | Returns the migrations that are not applied. | |
migrateDown ( string $class, $alias ) : boolean | Downgrades with the specified migration class. | |
migrateToTime ( integer $time ) | Migrates to the specified apply time in the past. | |
migrateToVersion ( string $version ) | Migrates to the certain version. | |
migrateUp ( string $class, $alias ) : boolean | Upgrades with the specified migration class. |
public actionCreate ( string $name ) | ||
$name | string | the name of the new migration. This should only contain letters, digits and/or underscores. |
public actionDown ( integer $limit = 1 ) | ||
$limit | integer | the number of migrations to be reverted. Defaults to 1, meaning the last applied migration will be reverted. |
public actionHistory ( integer $limit = 10 ) | ||
$limit | integer | the maximum number of migrations to be displayed. If it is 0, the whole migration history will be displayed. |
public actionMark ( string $version ) | ||
$version | string | the version at which the migration history should be marked. This can be either the timestamp or the full name of the migration. |
public actionRedo ( integer $limit = 1 ) | ||
$limit | integer | the number of migrations to be redone. Defaults to 1, meaning the last applied migration will be redone. |
public beforeAction ( |
||
$action | the action to be executed. | |
return | boolean | whether the action should continue to be executed. |
protected createMigration ( string $class, $alias ) : |
||
$class | string | the migration class name |
return | the migration instance |
protected createMigrationHistoryTable ( ) |
protected getMigrationHistory ( integer $limit ) : array | ||
$limit | integer | the maximum number of records in the history to be returned |
return | array | the migration history |
protected getNewMigrations ( ) : array | ||
return | array | list of new migrations, (key: migration version; value: alias) |
protected migrateDown ( string $class, $alias ) : boolean | ||
$class | string | the migration class name |
return | boolean | whether the migration is successful |
protected migrateToTime ( integer $time ) | ||
$time | integer | UNIX timestamp value. |
protected migrateToVersion ( string $version ) | ||
$version | string | name in the full format. |
public $db |
public $interactive |
public $migrationLookup |
public $migrationPath |
public $migrationTable |