if ($info->{mysql_values}) {
$extra_info{extra}{list} = $info->{mysql_values};
}
-# XXX we need to distinguish between DEFAULT CURRENT_TIMESTAMP and DEFAULT 'foo'
-# somehow, but DBI column_info doesn't preserve quotes.
- if ($info->{COLUMN_DEF} =~ /^CURRENT_TIMESTAMP\z/i) {
+ if ( $info->{COLUMN_DEF} =~ /^CURRENT_TIMESTAMP\z/i
+ && $info->{mysql_type_name} =~ /^TIMESTAMP\z/i) {
+
$extra_info{default_value} = \'CURRENT_TIMESTAMP';
}
qq{
CREATE TABLE mysql_loader_test2 (
id INTEGER UNSIGNED NOT NULL PRIMARY KEY,
- somedate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- somestr VARCHAR(100) NOT NULL DEFAULT 'foo'
+ somets TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
)
},
],
'MySQL ENUM values');
$rs = $schema->resultset($monikers->{mysql_loader_test2});
- $column_info = $rs->result_source->column_info('somedate');
+ $column_info = $rs->result_source->column_info('somets');
my $default = $column_info->{default_value};
ok ((ref($default) eq 'SCALAR'),
'CURRENT_TIMESTAMP default_value is a scalar ref');