Yii Migration with MySQL

Dear Experts,

I am new to Yii’s Migration.

I just started to use it but encounter problems.

I followed this guideline to do the migration: http://www.yiiframework.com/doc/guide/1.1/en/database.migration

However, I just used alterColumn instead.

But when I do migration, it said Altering a DB column is not supported by SQLite.

But I am sure I am using MySQL.

Here is my db setting in config:




'db'=>array(

	'class'=>'CDbConnection',

	'connectionString' => 'mysql:host=localhost;dbname=glow',

	'emulatePrepare' => true,

	'username' => 'root',

	'password' => '',

	'charset' => 'utf8',

),



Thanks.

Regards,

Cato

I made that mistake too - twice…

You need to change config/console.php :)

What I do, is create a separate file called db.php:




<?php

return array(

            'connectionString' => 'mysql:host={host_in};dbname={dbname_in}',

            'emulatePrepare' => true,

            'username' => '{username_in}',

            'tablePrefix' => '{tablePrefix_in}',

            'password' => '{password_in}',

            'charset' => '{charset_in}',

        );



and then I include it like this in the components array:




        'db' => require(dirname(__FILE__) . '/db.php'),



That way you can have the same db config for both the main configuration and the console configuration.

(And you can exclude db.php from source control too…)