PHP Класс yii\mongodb\console\controllers\MigrateController

This is an analog of MigrateController for MongoDB. This command provides support for tracking the migration history, upgrading or downloading with migrations, and creating new migration skeletons. The migration history is stored in a MongoDB collection named as [[migrationCollection]]. This collection will be automatically created the first time this command is executed, if it does not exist. In order to enable this command you should adjust the configuration of your console application: php return [ ... 'controllerMap' => [ 'mongodb-migrate' => 'yii\mongodb\console\controllers\MigrateController' ], ]; Below are some common usages of this command: php # creates a new migration named 'create_user_collection' yii mongodb-migrate/create create_user_collection # applies ALL new migrations yii mongodb-migrate # reverts the last applied migration yii mongodb-migrate/down Since 2.1.2, in case of usage Yii version >= 2.0.10, you can use namespaced migrations. In order to enable this feature you should configure [[migrationNamespaces]] property for the controller at application configuration: php return [ 'controllerMap' => [ 'mongodb-migrate' => [ 'class' => 'yii\mongodb\console\controllers\MigrateController', 'migrationNamespaces' => [ 'app\migrations', 'some\extension\migrations', ], 'migrationPath' => null, // allows to disable not namespaced migration completely ], ], ];
С версии: 2.0
Автор: Klimov Paul ([email protected])
Наследование: extends yii\console\controllers\BaseMigrateController
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$db the DB connection object or the application component ID of the DB connection.
$migrationCollection the name of the collection for keeping applied migration information.
$templateFile

Открытые методы

Метод Описание
beforeAction ( Action $action ) : boolean 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 )

Защищенные методы

Метод Описание
addMigrationHistory ( $version )
createMigration ( string $class ) : Migration Creates a new migration instance.
ensureBaseMigrationHistory ( ) Ensures migration history contains at least base migration entry.
getMigrationHistory ( $limit )
removeMigrationHistory ( $version )

Описание методов

addMigrationHistory() защищенный Метод

protected addMigrationHistory ( $version )

beforeAction() публичный Метод

This method is invoked right before an action is to be executed (after all possible filters.) It checks the existence of the [[migrationPath]].
public beforeAction ( Action $action ) : boolean
$action yii\base\Action the action to be executed.
Результат boolean whether the action should continue to be executed.

createMigration() защищенный Метод

Creates a new migration instance.
protected createMigration ( string $class ) : Migration
$class string the migration class name
Результат yii\mongodb\Migration the migration instance

ensureBaseMigrationHistory() защищенный Метод

Ensures migration history contains at least base migration entry.

getMigrationHistory() защищенный Метод

protected getMigrationHistory ( $limit )

options() публичный Метод

public options ( $actionID )

removeMigrationHistory() защищенный Метод

protected removeMigrationHistory ( $version )

Описание свойств

$db публичное свойство

the DB connection object or the application component ID of the DB connection.
public $db

$migrationCollection публичное свойство

the name of the collection for keeping applied migration information.
public $migrationCollection

$templateFile публичное свойство

public $templateFile