In Yii framework I used migration just like
./yiic migrate create tbl_demo
it made the migration file where I entered the values for up like
<?php
class m110714_094912_tbl_demo extends CDbMigration
{
public function up()
{
$this-> createTable('{{tbl_demo}}', array(
'id' => 'pk',
'name' => 'VARCHAR \'80\' NOT NULL',
))
}
public function down()
{
echo "m110714_094912_tbl_demo does not support migration down.\n";
return false;
}
/*
// Use safeUp/safeDown to do migration with transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
after entering this it is showing message like
New migration created successfully.
But whenever I am checking mysql database there is no table for tbl_demo is found. I also put all the values of up in safeup but it not made any result.Every thing is working fine but don’t know why new table is not creating? Please help me
You should go to the command line and call
yiic migrate upand it will ask you if you want to apply the tbl_demo migration and when you type in “yes” it will execute the code. The messageNew migration created successfully.appears when you executeyiic migrate create -something-not when you apply the migration.If you want to apply the migration again, you should delete the row regarding “tbl_demo” migration in the “migrations” db table that yiic created to log the migrations.