Yii迁移和自定义抽象数据类型

I'm working on a project and using Yii's Migration feature to keep the different production and test systems in sync. I must say i love this tool. My question is there a way to create custom Abstract Data Types?

I know Yii's migration feature is made to allow table creation in multiple DBMS systems but my site is limited to MySQL so that should help things along. What I would like to do is:

$this->createTable('test_table', array(
      'key'=>'pk',
      'active_YN'=>'yn',
));

instead of:

$this->createTable('test_table', array(
      'key'=>'pk',
      'active_YN'=>'TINYINT(1) NOT NULL DEFAULT \'1\'',
));

Im guessing that i would have to extend CDbMigration, possibly with a behavior?

Many Thanks.

If you still want to make the trick, here is what you can try.

MySQL uses the driver CMysqlSchema by default. You need to extend this class with your custom abstract column types.

class MyCustomMysqlSchema extends CMysqlSchema
{
    /**
     * @var array the abstract column types mapped to physical column types.
     */
    public $columnTypes=array(
        'pk' => 'int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY',
        'string' => 'varchar(255)',
        'text' => 'text',
        'integer' => 'int(11)',
        'float' => 'float',
        'decimal' => 'decimal',
        'datetime' => 'datetime',
        'timestamp' => 'timestamp',
        'time' => 'time',
        'date' => 'date',
        'binary' => 'blob',
        'boolean' => 'tinyint(1)',
        'money' => 'decimal(19,4)',
        // add your custom abstract column types here
        'yn' => 'tinyint(1) UNSIGNED NOT NULL DEFAULT 1',
    );
}

You need your connection to use this new driver. Modify your db configuration as follow.

'db'=>array(
    // your initial db configuration here
    'driverMap'=>array('mysql'=>'MyCustomMysqlSchema'),
),