Closed seyfer closed 10 years ago
Try this
'created_at' => array('timestamp', 'default' => DB::expr('CURRENT_TIMESTAMP')) or 'created_at' => array('timestamp', 'default' => 'CURRENT_TIMESTAMP')
'created_at' => array('timestamp', 'default' => DB::expr('CURRENT_TIMESTAMP'))
'created_at' => array('timestamp', 'default' => 'CURRENT_TIMESTAMP')
and have error
1396501173_create_table_pref_pay_tpl Create_Table_Pref_Pay_Tpl : migrating up -- create_table( pref_pay_tpl, array(id, name, updated_at, created_at) ) error: Migration_Exception [ 0 ]: CREATE TABLEpref_pay_tpl(idINT,nameVARCHAR (255),updated_atDATETIME NOT NULL,created_atTIMESTAMP DEFAULT 'CURRENT_TIMESTAMP') Exception: SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created_at' ~ MODPATH/timestamped-migrations/classes/migration/driver/mysql.php [ 85 ]
1396501173_create_table_pref_pay_tpl Create_Table_Pref_Pay_Tpl : migrating up -- create_table( pref_pay_tpl, array(id, name, updated_at, created_at) ) error: Migration_Exception [ 0 ]: CREATE TABLE
(
INT,
VARCHAR (255),
DATETIME NOT NULL,
TIMESTAMP DEFAULT 'CURRENT_TIMESTAMP') Exception: SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created_at' ~ MODPATH/timestamped-migrations/classes/migration/driver/mysql.php [ 85 ]
here is my code
class Create_Table_Pref_Pay_Tpl extends Migration { public function up() { $this->create_table('pref_pay_tpl', array( 'id' => array('integer'), "name" => array("string"), 'updated_at' => array('datetime', "null" => FALSE), // 'created_at' => array('timestamp', 'default' => DB::expr('CURRENT_TIMESTAMP')), 'created_at' => array('timestamp', 'default' => 'CURRENT_TIMESTAMP'), )); } public function down() { $this->drop_table('pref_pay_tpl'); } }
This works in this module https://github.com/ferpetrelli/kohana-flexible-migrations
maybe you can fix?
try it:
'created_at' => 'timestamp',
Fix for 3.2 branch too, please.
Try this
'created_at' => array('timestamp', 'default' => DB::expr('CURRENT_TIMESTAMP'))
or'created_at' => array('timestamp', 'default' => 'CURRENT_TIMESTAMP')
and have error
1396501173_create_table_pref_pay_tpl Create_Table_Pref_Pay_Tpl : migrating up -- create_table( pref_pay_tpl, array(id, name, updated_at, created_at) ) error: Migration_Exception [ 0 ]: CREATE TABLE
pref_pay_tpl(
idINT,
nameVARCHAR (255),
updated_atDATETIME NOT NULL,
created_atTIMESTAMP DEFAULT 'CURRENT_TIMESTAMP') Exception: SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created_at' ~ MODPATH/timestamped-migrations/classes/migration/driver/mysql.php [ 85 ]
here is my code
class Create_Table_Pref_Pay_Tpl extends Migration { public function up() { $this->create_table('pref_pay_tpl', array( 'id' => array('integer'), "name" => array("string"), 'updated_at' => array('datetime', "null" => FALSE), // 'created_at' => array('timestamp', 'default' => DB::expr('CURRENT_TIMESTAMP')), 'created_at' => array('timestamp', 'default' => 'CURRENT_TIMESTAMP'), )); } public function down() { $this->drop_table('pref_pay_tpl'); } }
This works in this module https://github.com/ferpetrelli/kohana-flexible-migrations
maybe you can fix?