From: Zbigniew Łukasiak Date: Mon, 22 Aug 2011 11:08:08 +0000 (-0700) Subject: Merge pull request #4 from ilmari/master X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-DBIx-Class-ResultSet-RecursiveUpdate;a=commitdiff_plain;h=7a1370a25e46f41b28349f9fb225e3b8caa6791c;hp=9dc8938b884bc17212e662c80e43750325287938 Merge pull request #4 from ilmari/master Fix PostgreSQL foreign key deployment errors --- diff --git a/t/lib/DBSchema/Result/Dvd.pm b/t/lib/DBSchema/Result/Dvd.pm index aedd435..b355e52 100644 --- a/t/lib/DBSchema/Result/Dvd.pm +++ b/t/lib/DBSchema/Result/Dvd.pm @@ -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' }); diff --git a/t/lib/DBSchemaBase.pm b/t/lib/DBSchemaBase.pm index 5b19a6e..4b7e6a4 100644 --- a/t/lib/DBSchemaBase.pm +++ b/t/lib/DBSchemaBase.pm @@ -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 8afc891..d11e10d 100644 --- 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);