Each child class of Migration represents an individual MongoDB migration which is identified by the child class name. Within each migration, the [[up()]] method should be overridden to contain the logic for "upgrading" the database; while the [[down()]] method for the "downgrading" logic. Migration provides a set of convenient methods for manipulating MongoDB data and schema. For example, the Migration::createIndex method can be used to create a collection index. Compared with the same methods in Collection, these methods will display extra information showing the method parameters and execution time, which may be useful when applying migrations.
Since: 2.0
Author: Klimov Paul (klimov@zfort.com)
Inheritance: extends yii\base\Component, implements yii\db\MigrationInterface
Example #1
0
 public function setUp()
 {
     $this->migrateControllerClass = MigrateController::className();
     $this->migrationBaseClass = Migration::className();
     parent::setUp();
     $this->setUpMigrationPath();
     Yii::$app->setComponents(['mongodb' => $this->getConnection()]);
 }