console\controllers\BaseMigrateController actionCreate()

actionCreate() public method

Creates a new migration.

This command creates a new migration using the available migration template. After using this command, developers should modify the created migration skeleton by filling up the actual migration logic.

yii migrate/create create_user_table

In order to generate a namespaced migration, you should specify a namespace before the migration's name. Note that backslash (\) is usually considered a special character in the shell, so you need to escape it properly to avoid shell errors or incorrect behavior. For example:

yii migrate/create 'app\\migrations\\createUserTable'

In case $migrationPath is not set and no namespace is provided, the first entry of $migrationNamespaces will be used.

public void actionCreate ( $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.

throws yii\console\Exception

if the name argument is invalid.

doc_Yii
2016-10-30 16:54:56
Comments
Leave a Comment

Please login to continue.