},
);
__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' });
}
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 );
. ' (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);