My problem is that Yii only supports ‘string’ which translates to “varchar(255)” in mySQL or ‘character varying(255)’ in Postgres. Is there a way to set the length of the field both for mySQL and Postgres in a generic way?
$this->createTable('tbl_news', array(
'id' => 'pk',
'title' => 'string NOT NULL', // HOW would I set the field length here in a cross-DB compatible way?
'content' => 'text',
));
Is the current mapping array in CMysqlSchema. You could extend and edit this array and add the line:
'string10' => 'varchar(10)',
Or alternatively you could turn getColumnType into a more intelligent parser but once again you are exending schemas. Nothing wrong with this, many of the projects I have worked on in the past use a custom schema implementation.