]> Dogcows Code - chaz/p5-DBIx-Class-ResultSet-RecursiveUpdate/commitdiff
Merge pull request #4 from ilmari/master
authorZbigniew Łukasiak <zzbbyy@gmail.com>
Mon, 22 Aug 2011 11:08:08 +0000 (04:08 -0700)
committerZbigniew Łukasiak <zzbbyy@gmail.com>
Mon, 22 Aug 2011 11:08:08 +0000 (04:08 -0700)
Fix PostgreSQL foreign key deployment errors

t/lib/DBSchema/Result/Dvd.pm
t/lib/DBSchemaBase.pm
t/pg.t

index aedd4354af028c112d81492a15ae728ccd7a22ac..b355e52655c7feaf723d85d34e4a8fc94b09428a 100644 (file)
@@ -45,6 +45,8 @@ __PACKAGE__->add_columns(
   },
 );
 __PACKAGE__->set_primary_key('dvd_id');
+__PACKAGE__->add_unique_constraint(dvd_name => [qw(name)]);
+__PACKAGE__->add_unique_constraint(dvd_twokeys => [qw(twokeysfk)]);
 __PACKAGE__->belongs_to('owner', 'DBSchema::Result::User', 'owner');
 __PACKAGE__->belongs_to('current_borrower', 'DBSchema::Result::User', 'current_borrower', { join_type => "LEFT" });
 __PACKAGE__->has_many('dvdtags', 'Dvdtag', { 'foreign.dvd' => 'self.dvd_id' });
index 5b19a6e5d8dba63371ca9e7e7957a209a380fdc2..4b7e6a4952d8253d9909355717fe34cd9c7d97a4 100644 (file)
@@ -11,10 +11,10 @@ sub tables_exist {
 }
 
 sub get_test_schema {
-    my ( $class, $dsn, $user, $pass ) = @_;
+    my ( $class, $dsn, $user, $pass, $opts ) = @_;
     $dsn ||= 'dbi:SQLite:dbname=t/var/dvdzbr.db';
     warn "testing $dsn\n";
-    my $schema = $class->connect( $dsn, $user, $pass, {} );
+    my $schema = $class->connect( $dsn, $user, $pass, $opts || {} );
     my $deploy_attrs;
     $deploy_attrs->{add_drop_table} = 1 if tables_exist( $schema->storage->dbh );
     $schema->deploy( $deploy_attrs );
diff --git a/t/pg.t b/t/pg.t
index 8afc89191d39fe45651bdc2e693e608233814943..d11e10dbe2337678f07840fa9dc1e7071c6df0ab 100644 (file)
--- a/t/pg.t
+++ b/t/pg.t
@@ -12,6 +12,7 @@ plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test'
     . ' (note: creates and tables!)'
     unless ( $dsn && $user );
 
-my $schema = DBSchema->get_test_schema( $dsn, $user, $pass );
-
+my $schema = DBSchema->get_test_schema( $dsn, $user, $pass, {
+    on_connect_do  => [ 'SET client_min_messages=WARNING' ],
+} );
 run_tests($schema);
This page took 0.01998 seconds and 4 git commands to generate.