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

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -