Yii Multiple Tables Migrate

I am very new to YII but had an experience with php frameworks already.

I found it good and bad ass!

I am a fan of rails migrate and good thing YII adopted it.

While using Yii migrate I found that there is a need to define

multiple tables in the command, especially for relationships wherein

it would require a lot of tables.

I have to hack the migration core source code but i know there is a better

way to do this. so my code is available at github .com/ wcabundo /Yii-Multiple-Tables-Migrate

anyone can fork it.

To preview what the command can do, please see below.

USAGE:

./yiic migrate create test_tables --table-alias=‘tbl_user:user, tbl_project:project, tbl_connection:connection’

It will now generate

<?php

class m110705_085429_test_tables extends CDbMigration {

private &#036;user = 'tbl_user';


private &#036;project = 'tbl_project';


private &#036;connection = 'tbl_connection';





public function up() {


    &#036;fields = array(


        'id'=&gt;'INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT',


        'create_time'=&gt;'DATETIME',


        'update_time'=&gt;'DATETIME',


    );


    


    &#036;this-&gt;createTable(&#036;this-&gt;user,&#036;fields);


    &#036;this-&gt;createTable(&#036;this-&gt;project,&#036;fields);


    &#036;this-&gt;createTable(&#036;this-&gt;connection,&#036;fields);        


}





public function down()


{


    &#036;this-&gt;dropTable(&#036;this-&gt;user);


    &#036;this-&gt;dropTable(&#036;this-&gt;project);


    &#036;this-&gt;dropTable(&#036;this-&gt;connection);


}

}