[Bast-commits] r3986 - in
branches/DBIx-Class-Schema-Loader/current: .
lib/DBIx/Class/Schema/Loader/DBI t
ilmari at dev.catalyst.perl.org
ilmari at dev.catalyst.perl.org
Tue Jan 29 15:12:17 GMT 2008
Author: ilmari
Date: 2008-01-29 15:12:17 +0000 (Tue, 29 Jan 2008)
New Revision: 3986
Modified:
branches/DBIx-Class-Schema-Loader/current/Changes
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:
Add support for ENUM value lists for MySQL
Modified: branches/DBIx-Class-Schema-Loader/current/Changes
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/Changes 2008-01-29 04:19:51 UTC (rev 3985)
+++ branches/DBIx-Class-Schema-Loader/current/Changes 2008-01-29 15:12:17 UTC (rev 3986)
@@ -4,6 +4,7 @@
- Mark foreign key columns with is_foreign_key => 1
- Add support for vendor-specific extra column attributes.
- Add support for extra => { unsigned => 1 } for MySQL.
+ - Add support for enum value lists for MySQL
- Set join_type => 'LEFT OUTER' for nullable foreign keys
(patch from Bernhard Weißhuhn)
- Set is_auto_increment for auto-increment columns (RT #31473)
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 2008-01-29 04:19:51 UTC (rev 3985)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm 2008-01-29 15:12:17 UTC (rev 3986)
@@ -129,8 +129,11 @@
$extra_info{is_auto_increment} = 1
}
if ($info->{mysql_type_name} =~ /\bunsigned\b/i) {
- $extra_info{extra} = { unsigned => 1 };
+ $extra_info{extra}{unsigned} = 1;
}
+ if ($info->{mysql_values}) {
+ $extra_info{extra}{list} = $info->{mysql_values};
+ }
return \%extra_info;
}
Modified: branches/DBIx-Class-Schema-Loader/current/t/11mysql_common.t
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/11mysql_common.t 2008-01-29 04:19:51 UTC (rev 3985)
+++ branches/DBIx-Class-Schema-Loader/current/t/11mysql_common.t 2008-01-29 15:12:17 UTC (rev 3986)
@@ -24,19 +24,26 @@
create => [
qq{
CREATE TABLE mysql_loader_test1 (
- id INTEGER UNSIGNED NOT NULL PRIMARY KEY
+ id INTEGER UNSIGNED NOT NULL PRIMARY KEY,
+ value ENUM('foo', 'bar', 'baz')
)
},
],
drop => [ qw/ mysql_loader_test1 / ],
- count => 1,
+ count => 3,
run => sub {
my ($schema, $monikers, $classes) = @_;
my $rs = $schema->resultset($monikers->{mysql_loader_test1});
my $column_info = $rs->result_source->column_info('id');
-
+
is($column_info->{extra}->{unsigned}, 1, 'Unsigned MySQL columns');
+
+ $column_info = $rs->result_source->column_info('value');
+
+ like($column_info->{data_type}, qr/^enum$/i, 'MySQL ENUM type');
+ is_deeply($column_info->{extra}->{list}, [qw/foo bar baz/],
+ 'MySQL ENUM values');
},
}
);
More information about the Bast-commits
mailing list