From: Rafael Kitover Date: Mon, 19 Jul 2010 20:48:22 +0000 (-0400) Subject: test for qualified Pg sequence X-Git-Tag: 0.07001~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7b86848108e4505349fa9e1a778ce225fbfddef6;p=dbsrgits%2FDBIx-Class-Schema-Loader.git test for qualified Pg sequence --- diff --git a/t/12pg_common.t b/t/12pg_common.t index bb03601..e40cbd6 100644 --- a/t/12pg_common.t +++ b/t/12pg_common.t @@ -113,8 +113,14 @@ my $tester = dbixcsl_common_tests->new( extra => { create => [ q{ + CREATE SCHEMA dbicsl_test + }, + q{ + CREATE SEQUENCE dbicsl_test.myseq + }, + q{ CREATE TABLE pg_loader_test1 ( - id SERIAL NOT NULL PRIMARY KEY, + id INTEGER NOT NULL DEFAULT nextval('dbicsl_test.myseq') PRIMARY KEY, value VARCHAR(100) ) }, @@ -134,11 +140,18 @@ my $tester = dbixcsl_common_tests->new( COMMENT ON TABLE pg_loader_test2 IS 'very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long comment' }, ], + pre_drop_ddl => [ + 'DROP SCHEMA dbicsl_test CASCADE', + ], drop => [ qw/ pg_loader_test1 pg_loader_test2 / ], - count => 3, + count => 4, run => sub { my ($schema, $monikers, $classes) = @_; + is $schema->source($monikers->{pg_loader_test1})->column_info('id')->{sequence}, + 'dbicsl_test.myseq', + 'qualified sequence detected'; + my $class = $classes->{pg_loader_test1}; my $filename = $schema->_loader->_get_dump_filename($class); diff --git a/t/lib/dbixcsl_common_tests.pm b/t/lib/dbixcsl_common_tests.pm index 1cb1ce2..22dc59d 100644 --- a/t/lib/dbixcsl_common_tests.pm +++ b/t/lib/dbixcsl_common_tests.pm @@ -155,7 +155,12 @@ sub drop_extra_tables_only { my $self = shift; my $dbh = $self->dbconnect(0); - $dbh->do($_) for @{ $self->{extra}{pre_drop_ddl} || [] }; + + { + local $SIG{__WARN__} = sub {}; # postgres notices + $dbh->do($_) for @{ $self->{extra}{pre_drop_ddl} || [] }; + } + $dbh->do("DROP TABLE $_") for @{ $self->{extra}{drop} || [] }; foreach my $data_type_table (@{ $self->{data_type_tests}{table_names} || [] }) { @@ -1715,7 +1720,11 @@ sub drop_tables { my $dbh = $self->dbconnect(0); - $dbh->do($_) for @{ $self->{extra}{pre_drop_ddl} || [] }; + { + local $SIG{__WARN__} = sub {}; # postgres notices + $dbh->do($_) for @{ $self->{extra}{pre_drop_ddl} || [] }; + } + $dbh->do("DROP TABLE $_") for @{ $self->{extra}{drop} || [] }; my $drop_auto_inc = $self->{auto_inc_drop_cb} || sub {};