프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$db | the DB connection object or the application component ID of the DB connection to use when applying migrations. Starting from version 2.0.3, this can also be a configuration array for creating the object. | ||
$fields | column definition strings used for creating migration code. The format of each definition is COLUMN_NAME:COLUMN_TYPE:COLUMN_DECORATOR. Delimiter is ,. For example, --fields="name:string(12):notNull:unique" produces a string column of size 12 which is not null and unique values. Note: primary key is added automatically and is named id by default. If you want to use another name you may specify it explicitly like --fields="id_key:primaryKey,name:string(12):notNull:unique" | ||
$generatorTemplateFiles | a set of template paths for generating migration code automatically. The key is the template type, the value is a path or the alias. Supported types are: - create_table: table creating template - drop_table: table dropping template - add_column: adding new column template - drop_column: dropping column template - create_junction: create junction template | ||
$migrationTable | the name of the table for keeping applied migration information. | ||
$templateFile | |||
$useTablePrefix | indicates whether the table names generated should consider the tablePrefix setting of the DB connection. For example, if the table name is post the generator wil return {{%post}}. |
메소드 | 설명 | |
---|---|---|
beforeAction ( |
This method is invoked right before an action is to be executed (after all possible filters.) It checks the existence of the [[migrationPath]]. | |
optionAliases ( ) | ||
options ( $actionID ) |
메소드 | 설명 | |
---|---|---|
addDefaultPrimaryKey ( array &$fields ) | Adds default primary key to fields list if there's no primary key specified | |
addMigrationHistory ( $version ) | ||
createMigration ( string $class ) : |
Creates a new migration instance. | |
createMigrationHistoryTable ( ) | Creates the migration history table. | |
generateMigrationSourceCode ( $params ) | ||
generateTableName ( string $tableName ) : string | If useTablePrefix equals true, then the table name will contain the prefix format. | |
getMigrationHistory ( $limit ) | ||
parseFields ( ) : array | Parse the command line migration fields | |
removeMigrationHistory ( $version ) |
protected addDefaultPrimaryKey ( array &$fields ) | ||
$fields | array | parsed fields |
public beforeAction ( |
||
$action | the action to be executed. | |
리턴 | boolean | whether the action should continue to be executed. |
protected createMigration ( string $class ) : |
||
$class | string | the migration class name |
리턴 | the migration instance |
protected createMigrationHistoryTable ( ) |
protected generateTableName ( string $tableName ) : string | ||
$tableName | string | the table name to generate. |
리턴 | string |
protected parseFields ( ) : array | ||
리턴 | array | parse result with following fields: - fields: array, parsed fields - foreignKeys: array, detected foreign keys |
public $db |
public $fields |
public $generatorTemplateFiles |
public $migrationTable |