[Bast-commits] r8338 - in branches/DBIx-Class-Schema-Loader/current:
lib/DBIx/Class/Schema/Loader/DBI t
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Sun Jan 17 14:19:21 GMT 2010
Author: caelum
Date: 2010-01-17 14:19:21 +0000 (Sun, 17 Jan 2010)
New Revision: 8338
Modified:
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm
branches/DBIx-Class-Schema-Loader/current/t/11mysql_common.t
Log:
check for "CURRENT_TIMESTAMP" only for "TIMESTAMP" columns in MySQL
Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm 2010-01-17 13:00:20 UTC (rev 8337)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm 2010-01-17 14:19:21 UTC (rev 8338)
@@ -129,9 +129,9 @@
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';
}
Modified: branches/DBIx-Class-Schema-Loader/current/t/11mysql_common.t
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/11mysql_common.t 2010-01-17 13:00:20 UTC (rev 8337)
+++ branches/DBIx-Class-Schema-Loader/current/t/11mysql_common.t 2010-01-17 14:19:21 UTC (rev 8338)
@@ -32,8 +32,7 @@
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
)
},
],
@@ -54,7 +53,7 @@
'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');
More information about the Bast-commits
mailing list