Multiple Databases

I am trying to migrate my app in with multiple databases. I have 3 databases in my app and when I run migrations I need to apply different settings to each database.

I have read this and tried to apply it but it does not work

http://www.yiiframework.com/doc-2.0/guide-db-migrations.html#migrating-multiple-databases

I used this code (but even if this did work ideally i would like to in the up function apply some changes to db 1 and some changes to db 2. Thanks for your help.

[color=#000080]consol/migrations[/color][color=#000080][b]<?php

[/b][/color][color=#000080][b]

[/b][/color][color=#000080]use [/color]yii\db\Migration;

[color=#000080]class [/color]m161208_142322_migrate2 [color=#000080]extends [/color]Migration

{

[color=#000080][b]public function [/b][/color]init()


{


    [color=#660000]&#036;this[/color]-&gt;[color=#660e7a][b]db [/b][/color]= [color=#008000][b]'db2'[/b][/color];


    [color=#000080][b]parent[/b][/color]::[i]init[/i]();


}





[color=#000080][b]public function [/b][/color]up()


{


    [color=#660000]&#036;this[/color]-&gt;createTable([color=#008000][b]'news2'[/b][/color], [


        [color=#008000][b]'id' [/b][/color]=&gt; [color=#660000]&#036;this[/color]-&gt;primaryKey(),


        [color=#008000][b]'title' [/b][/color]=&gt; [color=#660000]&#036;this[/color]-&gt;string()-&gt;notNull(),


        [color=#008000][b]'content' [/b][/color]=&gt; [color=#660000]&#036;this[/color]-&gt;text(),


    ]);





}





[color=#000080][b]public function [/b][/color]down()


{


    [color=#000080][b]echo [/b][/color][color=#008000][b]&quot;m161208_142322_migrate2 cannot be reverted.[/b][/color][color=#000080][b]&#092;n[/b][/color][color=#008000][b]&quot;[/b][/color];





    [color=#000080][b]return false[/b][/color];


}





[color=#808080][i]/*

[/i][/color][color=#808080][i] // Use safeUp/safeDown to run migration code within a transaction

[/i][/color][color=#808080][i] public function safeUp()

[/i][/color][color=#808080][i] {

[/i][/color][color=#808080][i] }

[/i][/color][color=#808080][i]

[/i][/color][color=#808080][i] public function safeDown()

[/i][/color][color=#808080][i] {

[/i][/color][color=#808080][i] }

[/i][/color][color=#808080][i] */

[/i][/color]}

[color=#000080]Enviroments/dev/common/config[/color][color=#000080]<?php[/color][color=#000080][b]

[/b][/color][color=#000080]return [/color][

[color=#008000][b]'components' [/b][/color]=&gt; [


    [color=#008000][b]'db' [/b][/color]=&gt; [


        [color=#008000][b]'class' [/b][/color]=&gt; [color=#008000][b]'yii&#092;db&#092;Connection'[/b][/color],


        [color=#008000][b]'dsn' [/b][/color]=&gt; [color=#008000][b]'mysql:host=localhost;dbname=eurotech_main_db'[/b][/color],


        [color=#008000][b]'username' [/b][/color]=&gt; [color=#008000][b]'eurotech_all_db'[/b][/color],


        [color=#008000][b]'password' [/b][/color]=&gt; [color=#008000][b]'&#33;CN-xnvuNh&#33;@'[/b][/color],


        [color=#008000][b]'charset' [/b][/color]=&gt; [color=#008000][b]'utf8'[/b][/color],


    ],


    [color=#008000][b]'db1' [/b][/color]=&gt; [


        [color=#008000][b]'class' [/b][/color]=&gt; [color=#008000][b]'yii&#092;db&#092;Connection'[/b][/color],


        [color=#008000][b]'dsn' [/b][/color]=&gt; [color=#008000][b]'mysql:host=localhost;dbname=eurotech_db1'[/b][/color],


        [color=#008000][b]'username' [/b][/color]=&gt; [color=#008000][b]'eurotech_all_db'[/b][/color],


        [color=#008000][b]'password' [/b][/color]=&gt; [color=#008000][b]'&#33;CN-xnvuNh&#33;@'[/b][/color],


        [color=#008000][b]'charset' [/b][/color]=&gt; [color=#008000][b]'utf8'[/b][/color],


    ],


    [color=#008000][b]'db2' [/b][/color]=&gt; [


        [color=#008000][b]'class' [/b][/color]=&gt; [color=#008000][b]'yii&#092;db&#092;Connection'[/b][/color],


        [color=#008000][b]'dsn' [/b][/color]=&gt; [color=#008000][b]'mysql:host=localhost;dbname=eurotech_db2'[/b][/color],


        [color=#008000][b]'username' [/b][/color]=&gt; [color=#008000][b]'eurotech_all_db'[/b][/color],


        [color=#008000][b]'password' [/b][/color]=&gt; [color=#008000][b]'&#33;CN-xnvuNh&#33;@'[/b][/color],


        [color=#008000][b]'charset' [/b][/color]=&gt; [color=#008000][b]'utf8'[/b][/color],


    ],


    [color=#008000][b]'mailer' [/b][/color]=&gt; [


        [color=#008000][b]'class' [/b][/color]=&gt; [color=#008000][b]'yii&#092;swiftmailer&#092;Mailer'[/b][/color],


        [color=#008000][b]'viewPath' [/b][/color]=&gt; [color=#008000][b]'@common/mail'[/b][/color],


        [color=#808080][i]// send all mails to a file by default. You have to set

[/i][/color][color=#808080][i] // ‘useFileTransport’ to false and configure a transport

[/i][/color][color=#808080][i] // for the mailer to send real emails.

[/i][/color][color=#808080] [/color][color=#008000]‘useFileTransport’ [/color]=> [color=#000080]true[/color],

    ],


],

];