php - Yii Framework - yic migrate command doesn't work -


i trying create table using yii db migration in safeup() method. however, when use "./yiic migrate" command, runs table doesn't appear in database. following code migration file:

<?php  class m130808_123826_test_table extends cdbmigration {      public function up() { }  public function down() {    echo "m130808_123826_test_table not support migration down.\n";    return false; }  public function safeup() {    $this->createtable('tbl_test', array(    'test_field1' => 'int(10)',    'test_field2' => 'string not null',     ), 'engine=innodb'); }  public function safedown() {    $this->droptable('tbl_test'); }  } 

i tried using few suggestions comments on similar issue like, providing 'up' or 'safeup' parameter migrate command. checked console.php file , configured right database. else reason not creating table in database?

you should provide either up or safeup method. remove empty up method in class:

<?php  class m130808_123826_test_table extends cdbmigration {  public function down() {    echo "m130808_123826_test_table not support migration down.\n";    return false; }  public function safeup() {    $this->createtable('tbl_test', array(    'test_field1' => 'int(10)',    'test_field2' => 'string not null',     ), 'engine=innodb'); }  public function safedown() {    $this->droptable('tbl_test'); }  } 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -