There’s a wonderful extension to Yii 1.x, called
database-command, written by the one and only schmunk, which allows you to quickly and easily generate any set of
CDbMigrationCommands (actually, entire single migration code) based on current database schema.
This isn’t, of course, the only one out there. There are some others. But I like this one the most, mainly for flexibility (may parameters to suit generated migration file to your needs). However, if this is your first approach to using custom
yiic commands, you may get a little bit confused. This article should help you.