Doubt About Migrates

Hello friends

I use to use migrate to create my datase, I use this documentation:

http://www.yiiframework.com/doc/guide/1.1/en/database.migration#transactional-migrations

But now I have a project that has two databases, to create data base I use the console. How can I create a migrate to distinct database?

I use this command line to create a new table in database:

yiic migrate create create_news_table

But this command create de table in default database called ‘db’ in main.php, in my main.php I have two databases:




'db'=>array(

			'connectionString' => 'mysql:host=192.168.1.2;dbname=database1',

			'emulatePrepare' => true,

			'username' => 'root',

			'password' => '123456',

			'charset' => 'utf8',

		),

                'db2' => array(

                    'connectionString' => 'mysql:host=192.168.1.2;dbname=database2',

                    'username'         => 'root',

                    'password'         => '123456',

                    'charset'          => 'utf8',

                    'class'            => 'CDbConnection',          // DO NOT FORGET THIS!

                ),

When I use this line: yiic migrate create create_news_table

The table is created in ‘db’, How can I create migrate do ‘db2’?

you can specify the connectionID as a parameter on the command line like so


php protected/yiic migrate --connectionID='db2'

Very good

Thanks guy.