From: Stephen Bennett Date: Wed, 10 Nov 2010 22:03:08 +0000 (+0000) Subject: Create custom_type_name hint for PostgreSQL enum types, as used by very recent SQL... X-Git-Tag: 0.07003~37 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b8ae4518518752d47392c07448d561e6cff155a8;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Create custom_type_name hint for PostgreSQL enum types, as used by very recent SQL::Translator --- diff --git a/Changes b/Changes index 1c12d4a..58fa9c2 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for Perl extension DBIx::Class::Schema::Loader + - Generate custom_type_name hint for PostgreSQL enums, as used + by very recent SQL::Translator - Added support for PostgreSQL enum types - Added table/column comment support for Oracle - Fix missing require (RT#62072) diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm b/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm index 1b922f1..529be87 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm @@ -272,7 +272,9 @@ WHERE t.typname = ? EOF if (@$typevalues) { + # This is an enum type. Store its original name in extra for SQLT to pick up. $extra_info{extra}{list} = [ map { $_->[0] } @$typevalues ]; + $extra_info{extra}{custom_type_name} = $info->{data_type}; } return \%extra_info; diff --git a/t/12pg_common.t b/t/12pg_common.t index bdac57a..3bc7281 100644 --- a/t/12pg_common.t +++ b/t/12pg_common.t @@ -114,7 +114,8 @@ my $tester = dbixcsl_common_tests->new( bytea => { data_type => 'bytea' }, # Enum Types - pg_loader_test_enum => { data_type => 'enum', extra => { list => [ qw/foo bar baz/] }, size => 4 }, + pg_loader_test_enum => { data_type => 'enum', extra => { custom_type_name => 'pg_loader_test_enum', + list => [ qw/foo bar baz/] }, size => 4 }, }, pre_create => [ q{