Свойство | Type | Description | |
---|---|---|---|
$defaultAction | the default command action. | ||
$migrationNamespaces | list of namespaces containing the migration classes. Migration namespaces should be resolvable as a path alias if prefixed with @, e.g. if you specify the namespace app\migrations, the code Yii::getAlias('@app/migrations') should be able to return the file path to the directory this namespace refers to. For example: php [ 'app\migrations', 'some\extension\migrations', ] | ||
$migrationPath | the directory containing the migration classes. This can be either a path alias or a directory path. If you have set up [[migrationNamespaces]], you may set this field to null in order to disable usage of migrations that are not namespaced. | ||
$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. |
Méthode | Description | |
---|---|---|
actionCreate ( string $name ) | Creates a new migration. | |
actionDown ( integer $limit = 1 ) : integer | Downgrades the application by reverting old migrations. | |
actionHistory ( integer $limit = 10 ) | Displays the migration history. | |
actionMark ( string $version ) : integer | Modifies the migration history to the specified version. | |
actionNew ( integer $limit = 10 ) | Displays the un-applied new migrations. | |
actionRedo ( integer $limit = 1 ) : integer | Redoes the last few migrations. | |
actionTo ( string $version ) | Upgrades or downgrades till the specified version. | |
actionUp ( integer $limit ) : integer | 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 ) |
Méthode | Description | |
---|---|---|
addMigrationHistory ( string $version ) | Adds new migration entry to the history. | |
createMigration ( string $class ) : yii\db\MigrationInterface | Creates a new migration instance. | |
generateMigrationSourceCode ( array $params ) : string | Generates new migration source PHP code. | |
getMigrationHistory ( integer $limit ) : array | Returns the migration history. | |
getNewMigrations ( ) : array | Returns the migrations that are not applied. | |
migrateDown ( string $class ) : boolean | Downgrades with the specified migration class. | |
migrateToTime ( integer $time ) | Migrates to the specified apply time in the past. | |
migrateToVersion ( string $version ) : integer | Migrates to the certain version. | |
migrateUp ( string $class ) : boolean | Upgrades with the specified migration class. | |
removeMigrationHistory ( string $version ) | Removes existing migration from the history. |
Méthode | Description | |
---|---|---|
extractMigrationVersion ( string $rawVersion ) : string | false | Checks if given migration version specification matches migration base name. | |
extractNamespaceMigrationVersion ( string $rawVersion ) : string | false | Checks if given migration version specification matches namespaced migration name. | |
findMigrationPath ( string | null $namespace ) : string | Finds the file path for the specified migration namespace. | |
generateClassName ( string $name ) : array | Generates class base name and namespace from migration name from user input. | |
getNamespacePath ( string $namespace ) : string | Returns the file path matching the give namespace. |
public actionCreate ( string $name ) | ||
$name | string | the name of the new migration. This should only contain letters, digits, underscores and/or backslashes. Note: If the migration name is of a special form, for example create_xxx or drop_xxx, then the generated migration file will contain extra code, in this case for creating/dropping tables. |
public actionDown ( integer $limit = 1 ) : integer | ||
$limit | integer | the number of migrations to be reverted. Defaults to 1, meaning the last applied migration will be reverted. |
Résultat | integer | the status of the action execution. 0 means normal, other values mean abnormal. |
public actionHistory ( integer $limit = 10 ) | ||
$limit | integer | the maximum number of migrations to be displayed. If it is "all", the whole migration history will be displayed. |
public actionMark ( string $version ) : integer | ||
$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. |
Résultat | integer | CLI exit code |
public actionRedo ( integer $limit = 1 ) : integer | ||
$limit | integer | the number of migrations to be redone. Defaults to 1, meaning the last applied migration will be redone. |
Résultat | integer | the status of the action execution. 0 means normal, other values mean abnormal. |
abstract protected addMigrationHistory ( string $version ) | ||
$version | string | migration version name. |
public beforeAction ( |
||
$action | the action to be executed. | |
Résultat | boolean | whether the action should continue to be executed. |
protected createMigration ( string $class ) : yii\db\MigrationInterface | ||
$class | string | the migration class name |
Résultat | yii\db\MigrationInterface | the migration instance |
protected generateMigrationSourceCode ( array $params ) : string | ||
$params | array | generation parameters, usually following parameters are present: - name: string migration base name - className: string migration class name |
Résultat | string | generated PHP code. |
abstract protected getMigrationHistory ( integer $limit ) : array | ||
$limit | integer | the maximum number of records in the history to be returned. `null` for "no limit". |
Résultat | array | the migration history |
protected getNewMigrations ( ) : array | ||
Résultat | array | list of new migrations |
protected migrateDown ( string $class ) : boolean | ||
$class | string | the migration class name |
Résultat | boolean | whether the migration is successful |
protected migrateToTime ( integer $time ) | ||
$time | integer | UNIX timestamp value. |
protected migrateToVersion ( string $version ) : integer | ||
$version | string | name in the full format. |
Résultat | integer | CLI exit code |
abstract protected removeMigrationHistory ( string $version ) | ||
$version | string | migration version name. |
public $migrationNamespaces |
public $migrationPath |