[Bast-commits] r7405 - in
branches/DBIx-Class-Schema-Loader/mssql_tweaks: .
lib/DBIx/Class/Schema/Loader/DBI t
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Fri Aug 28 23:04:05 GMT 2009
Author: caelum
Date: 2009-08-28 23:03:49 +0000 (Fri, 28 Aug 2009)
New Revision: 7405
Modified:
branches/DBIx-Class-Schema-Loader/mssql_tweaks/
branches/DBIx-Class-Schema-Loader/mssql_tweaks/Makefile.PL
branches/DBIx-Class-Schema-Loader/mssql_tweaks/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm
branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/11mysql_common.t
Log:
r7308 at hlagh (orig r7307): caelum | 2009-08-11 20:58:06 -0400
fix CURRENT_TIMESTAMP default for MySQL
r7309 at hlagh (orig r7308): caelum | 2009-08-12 07:26:13 -0400
fix mysql tests for CURRENT_TIMESTAMP
r7310 at hlagh (orig r7309): caelum | 2009-08-12 07:51:05 -0400
add TODO comment for mysql
Property changes on: branches/DBIx-Class-Schema-Loader/mssql_tweaks
___________________________________________________________________
Name: svk:merge
- 46bc3436-8211-0410-8564-d96f7a728040:/local/DBIx-Class-Schema-Loader/branches/common-dump:37173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-Schema-Loader/current:7116
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-Schema-Loader/odbc-mssql:6439
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class-Schema-Loader:5726
+ 46bc3436-8211-0410-8564-d96f7a728040:/local/DBIx-Class-Schema-Loader/branches/common-dump:37173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-Schema-Loader/current:7309
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-Schema-Loader/odbc-mssql:6439
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class-Schema-Loader:5726
Modified: branches/DBIx-Class-Schema-Loader/mssql_tweaks/Makefile.PL
===================================================================
--- branches/DBIx-Class-Schema-Loader/mssql_tweaks/Makefile.PL 2009-08-28 14:34:46 UTC (rev 7404)
+++ branches/DBIx-Class-Schema-Loader/mssql_tweaks/Makefile.PL 2009-08-28 23:03:49 UTC (rev 7405)
@@ -9,6 +9,7 @@
test_requires 'DBD::SQLite' => '1.12';
test_requires 'File::Path' => 0;
test_requires 'IPC::Open3' => 0;
+test_requires 'Test::Exception';
requires 'File::Spec' => 0;
requires 'Scalar::Util' => 0;
Modified: branches/DBIx-Class-Schema-Loader/mssql_tweaks/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/mssql_tweaks/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm 2009-08-28 14:34:46 UTC (rev 7404)
+++ branches/DBIx-Class-Schema-Loader/mssql_tweaks/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm 2009-08-28 23:03:49 UTC (rev 7405)
@@ -122,6 +122,7 @@
}
sub _extra_column_info {
+ no warnings 'uninitialized';
my ($self, $info) = @_;
my %extra_info;
@@ -134,6 +135,11 @@
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) {
+ $extra_info{default_value} = \'CURRENT_TIMESTAMP';
+ }
return \%extra_info;
}
Modified: branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/11mysql_common.t
===================================================================
--- branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/11mysql_common.t 2009-08-28 14:34:46 UTC (rev 7404)
+++ branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/11mysql_common.t 2009-08-28 23:03:49 UTC (rev 7405)
@@ -28,9 +28,16 @@
value ENUM('foo', 'bar', 'baz')
)
},
+ 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'
+ )
+ },
],
- drop => [ qw/ mysql_loader_test1 / ],
- count => 3,
+ drop => [ qw/ mysql_loader_test1 mysql_loader_test2 / ],
+ count => 5,
run => sub {
my ($schema, $monikers, $classes) = @_;
@@ -44,6 +51,14 @@
like($column_info->{data_type}, qr/^enum$/i, 'MySQL ENUM type');
is_deeply($column_info->{extra}->{list}, [qw/foo bar baz/],
'MySQL ENUM values');
+
+ $rs = $schema->resultset($monikers->{mysql_loader_test2});
+ my $column_info = $rs->result_source->column_info('somedate');
+ my $default = $column_info->{default_value};
+ ok (ref($default) eq 'SCALAR'),
+ 'CURRENT_TIMESTAMP default_value is a scalar ref';
+ like $$default, qr/^CURRENT_TIMESTAMP\z/i,
+ 'CURRENT_TIMESTAMP default eq "CURRENT_TIMESTAMP"';
},
}
);
More information about the Bast-commits
mailing list