Subject: | Mysql provider quotes CURRENT_TIMESTAMP default value |
I have this column in almost all of my DBIx::Class schema files:
"modified_ts",
{
data_type => "TIMESTAMP",
default_value => "CURRENT_TIMESTAMP",
is_nullable => 0,
size => 14,
},
And when I use $schema->create_ddl_dir or $schema->deploy it generates
the wrong sql for the default value for those timestamp columns. The
sql (and error) it generates is:
DBIx::Class::Schema::connect(): DBI Exception: DBD::mysql::db do failed:
Invalid default value for 'modified_ts' [for Statement "CREATE TABLE
`result_types` (
`id` integer(10) NOT NULL,
`type` VARCHAR(45) NOT NULL DEFAULT '',
`modified_ts` TIMESTAMP(14) NOT NULL DEFAULT 'CURRENT_TIMESTAMP',
PRIMARY KEY (`id`)
) ENGINE=InnoDB"] at
/u/youngb/work/qa.icebox/icebox/Schema/t/lib/IceboxSchemaTest.pm line 131
The CURRENT_TIMESTAMP default value should not be quoted for TIMESTAMP
columns.
Thanks!
Byron