php - YII migrations and bu default values for table columns -
public function up(){ $this->createtable('post', array( 'id' => 'pk', 'isremoved' => 'integer not null', 'removaldate' => 'timestamp null', 'post' => 'text not null', 'creationdate' => 'timestamp not null', )); } this function migration. u see query creating new table. default yii creates default value timestamp column equal current_timestamp , crates additional parameter , sets equal on update current_timestamp.
i not need current value timestamp , not need update column on updating row. must do? way, u use mysql
leverage off mysql create table script:
show create table tablename which gives:
create table `tablename` ( .... .... `timestamp` timestamp not null default current_timestamp, ... now add migration:
'timestamp' => 'timestamp not null default current_timestamp'
Comments
Post a Comment