File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -30,3 +30,26 @@ yii mongodb-migrate
30
30
# 最後に適用されたマイグレーションを取り消す
31
31
yii mongodb-migrate/down
32
32
```
33
+ ## 二つ以上の DB エンジンを使用するアプリケーションのための特殊な構成
34
+
35
+ アプリケーションが複数のデータベースを使う場合の例です。
36
+
37
+ - MySQL + MongoDB
38
+
39
+ マイグレーション・コマンドを実行すると、同時に MySQL と MongoDB の両方のマイグレーション・ファイルが対象として扱われます。これは両者が既定では同じフォルダを共有するためです。
40
+
41
+ ** 問題: MongoDB が MySQL のマイグレーション・ファイルを実行しようとし、MySQL が MongoDB のマイグレーション・ファイルを実行しようとする。**
42
+
43
+ この問題を回避するためには、` migrations ` フォルダの下に ` mongodb ` という新しいフォルダを作って、コンソール・アプリケーションを次のようにセットアップすることが出来ます。
44
+
45
+ ``` php
46
+ return [
47
+ // ...
48
+ 'controllerMap' => [
49
+ 'mongodb-migrate' => [
50
+ 'class' => 'yii\mongodb\console\controllers\MigrateController',
51
+ 'migrationPath' => '@app/migrations/mongodb',
52
+ ],
53
+ ],
54
+ ];
55
+ ```
You can’t perform that action at this time.
0 commit comments