File tree 3 files changed +39
-5
lines changed
3 files changed +39
-5
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ Yii Framework 2 mongodb extension Change Log
7
7
- Bug #3385 : Fixed "The 'connected' property is deprecated" (samdark)
8
8
- Enh #3520 : Added ` unlinkAll() ` -method to active record to remove all records of a model relation (NmDimas, samdark, cebe)
9
9
- Enh #3778 : Gii generator for Active Record model added (klimov-paul)
10
- - Enh: Migration support added (klimov-paul)
10
+ - Enh # 3947 : Migration support added (klimov-paul)
11
11
12
12
13
13
2.0.0-beta April 13, 2014
Original file line number Diff line number Diff line change @@ -285,4 +285,38 @@ return [
285
285
```
286
286
287
287
> Note: since MongoDB is schemaless, there is not much information, which generated code may base on. So generated code
288
- is very basic and definitely requires adjustments.
288
+ is very basic and definitely requires adjustments.
289
+
290
+
291
+ Using Migrations
292
+ ----------------
293
+
294
+ MongoDB is schemaless and will create any missing collection on the first demand. However there are many cases, when
295
+ you may need applying persistent changes to the MongoDB database. For example: you may need to create a collection with
296
+ some specific options or create indexes.
297
+ MongoDB migrations are managed via [[ yii\mongodb\console\controllers\MigrateController]] , which is an analog of regular
298
+ [[ \yii\console\controllers\MigrateController]] .
299
+
300
+ In order to enable this command you should adjust the configuration of your console application:
301
+
302
+ ``` php
303
+ return [
304
+ // ...
305
+ 'controllerMap' => [
306
+ 'mongodb-migrate' => 'yii\mongodb\console\controllers\MigrateController'
307
+ ],
308
+ ];
309
+ ```
310
+
311
+ Below are some common usages of this command:
312
+
313
+ ```
314
+ # creates a new migration named 'create_user_collection'
315
+ yii mongodb-migrate/create create_user_collection
316
+
317
+ # applies ALL new migrations
318
+ yii mongodb-migrate
319
+
320
+ # reverts the last applied migration
321
+ yii mongodb-migrate/down
322
+ ```
Original file line number Diff line number Diff line change 17
17
/**
18
18
* Manages application MongoDB migrations.
19
19
*
20
- * This is an analog of [[\yii\console\controllers| MigrateController]] for MongoDB.
20
+ * This is an analog of [[\yii\console\controllers\ MigrateController]] for MongoDB.
21
21
*
22
22
* This command provides support for tracking the migration history, upgrading
23
23
* or downloading with migrations, and creating new migration skeletons.
40
40
* Below are some common usages of this command:
41
41
*
42
42
* ~~~
43
- * # creates a new migration named 'create_user_table '
44
- * yii mongodb-migrate/create create_user_table
43
+ * # creates a new migration named 'create_user_collection '
44
+ * yii mongodb-migrate/create create_user_collection
45
45
*
46
46
* # applies ALL new migrations
47
47
* yii mongodb-migrate
You can’t perform that action at this time.
0 commit comments