class m140113_223038_create_test_tables extends CDbMigration { public function up() { } public function down() { } public function safeUp() { $this->createTable('tbl_test',array( 'id'=>'pk', 'name'=>'string NOT NULL', ),'ENGINE=InnoDB'); } public function safeDown() { $this->dropTable('tbl_test'); } }However, it won't create a new table. The solution is actually very simple. If we want to use safeUp() function, we have to make sure that there's no up() function in the code. So, we have to remove both up() and down() function.
class m140113_223038_create_test_tables extends CDbMigration { public function safeUp() { $this->createTable('tbl_test',array( 'id'=>'pk', 'name'=>'string NOT NULL', ),'ENGINE=InnoDB'); } public function safeDown() { $this->dropTable('tbl_test'); } }Reference:
http://stackoverflow.com/questions/18126773/yii-framework-yic-migrate-command-doesnt-work
No comments:
Post a Comment