From: Peter Rabbitson Date: Sun, 9 Nov 2008 15:29:34 +0000 (+0000) Subject: Some testdb changes and alignment, preparing for test refactor branch X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a0dd86798d8077ff1035441888165367b45572e5;p=dbsrgits%2FDBIx-Class-Historic.git Some testdb changes and alignment, preparing for test refactor branch --- diff --git a/t/66relationship.t b/t/66relationship.t index 5d8052a..4506bda 100644 --- a/t/66relationship.t +++ b/t/66relationship.t @@ -128,8 +128,8 @@ my $newartist = $cd->find_or_new_related( 'artist', { is($newartist->name, 'Random Boy Band Two', 'find_or_new_related new artist record with id'); is($newartist->id, 200, 'find_or_new_related new artist id set'); -SKIP: { - skip "relationship checking needs fixing", 1; +TODO: { + local $TODO = "relationship checking needs fixing"; # try to add a bogus relationship using the wrong cols eval { DBICTest::Schema::Artist->add_relationship( diff --git a/t/71mysql.t b/t/71mysql.t index eff456d..dbba1cd 100644 --- a/t/71mysql.t +++ b/t/71mysql.t @@ -21,7 +21,7 @@ my $dbh = $schema->storage->dbh; $dbh->do("DROP TABLE IF EXISTS artist;"); -$dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10));"); +$dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10));"); #'dbi:mysql:host=localhost;database=dbic_test', 'dbic_test', ''); @@ -57,7 +57,7 @@ my $test_type_info = { 'name' => { 'data_type' => 'VARCHAR', 'is_nullable' => 1, - 'size' => 255, + 'size' => 100, 'default_value' => undef, }, 'rank' => { diff --git a/t/746mssql.t b/t/746mssql.t index aebdbf4..fd4cc58 100644 --- a/t/746mssql.t +++ b/t/746mssql.t @@ -24,7 +24,7 @@ eval { $dbh->do("DROP TABLE artist") }; $dbh->do(<<''); CREATE TABLE artist ( artistid INT IDENTITY NOT NULL, - name VARCHAR(255), + name VARCHAR(100), rank INT NOT NULL DEFAULT '13', charfield CHAR(10) NULL, primary key(artistid) diff --git a/t/74mssql.t b/t/74mssql.t index 44709cb..c5b4bb9 100644 --- a/t/74mssql.t +++ b/t/74mssql.t @@ -29,7 +29,7 @@ $dbh->do("IF OBJECT_ID('artist', 'U') IS NOT NULL $dbh->do("IF OBJECT_ID('cd', 'U') IS NOT NULL DROP TABLE cd"); -$dbh->do("CREATE TABLE artist (artistid INT IDENTITY PRIMARY KEY, name VARCHAR(255), rank INT DEFAULT '13');"); +$dbh->do("CREATE TABLE artist (artistid INT IDENTITY PRIMARY KEY, name VARCHAR(100), rank INT DEFAULT '13', charfield CHAR(10) NULL);"); $dbh->do("CREATE TABLE cd (cdid INT IDENTITY PRIMARY KEY, artist INT, title VARCHAR(100), year VARCHAR(100), genreid INT NULL);"); # Just to test compat shim, Auto is in Core $schema->class('Artist')->load_components('PK::Auto::MSSQL'); diff --git a/t/86sqlt.t b/t/86sqlt.t index c583414..ab76bbf 100644 --- a/t/86sqlt.t +++ b/t/86sqlt.t @@ -126,7 +126,7 @@ my %fk_constraints = ( 'name' => 'cd_fk_artist', 'index_name' => 'cd_idx_artist', 'selftable' => 'cd', 'foreigntable' => 'artist', 'selfcols' => ['artist'], 'foreigncols' => ['artistid'], - on_delete => '', on_update => 'SET NULL', deferrable => 1, + on_delete => 'CASCADE', on_update => 'CASCADE', deferrable => 1, }, ], diff --git a/t/93nobindvars.t b/t/93nobindvars.t index eddd72f..8a72864 100644 --- a/t/93nobindvars.t +++ b/t/93nobindvars.t @@ -40,7 +40,7 @@ my $dbh = $schema->storage->dbh; $dbh->do("DROP TABLE IF EXISTS artist;"); -$dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10));"); +$dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10));"); $schema->class('Artist')->load_components('PK::Auto'); diff --git a/t/98savepoints.t b/t/98savepoints.t index a7c5344..6ba78a3 100644 --- a/t/98savepoints.t +++ b/t/98savepoints.t @@ -15,7 +15,7 @@ if (exists $ENV{DBICTEST_PG_DSN}) { } elsif (exists $ENV{DBICTEST_MYSQL_DSN}) { ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/}; - $create_sql = "CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10)) ENGINE=InnoDB"; + $create_sql = "CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10)) ENGINE=InnoDB"; } else { plan skip_all => 'Set DBICTEST_(PG|MYSQL)_DSN _USER and _PASS if you want to run savepoint tests'; } diff --git a/t/bindtype_columns.t b/t/bindtype_columns.t index 7cc712c..12df2dc 100644 --- a/t/bindtype_columns.t +++ b/t/bindtype_columns.t @@ -22,10 +22,11 @@ my $dbh = $schema->storage->dbh; $dbh->do(qq[ CREATE TABLE artist ( - artistid serial NOT NULL PRIMARY KEY, - media bytea NOT NULL, - name varchar NULL, - rank integer NOT NULL DEFAULT '13' + artistid serial NOT NULL PRIMARY KEY, + media bytea NOT NULL, + name varchar(100) NULL, + rank integer NOT NULL DEFAULT '13', + charfield char(10) NULL ); ],{ RaiseError => 1, PrintError => 1 }); } diff --git a/t/lib/DBICTest/Schema/Artist.pm b/t/lib/DBICTest/Schema/Artist.pm index a542576..c772c5b 100644 --- a/t/lib/DBICTest/Schema/Artist.pm +++ b/t/lib/DBICTest/Schema/Artist.pm @@ -23,6 +23,11 @@ __PACKAGE__->add_columns( data_type => 'integer', default_value => 13, }, + charfield => { + data_type => 'char', + size => 10, + is_nullable => 1, + }, ); __PACKAGE__->set_primary_key('artistid'); diff --git a/t/lib/DBICTest/Schema/CD.pm b/t/lib/DBICTest/Schema/CD.pm index d121027..41ed6bd 100644 --- a/t/lib/DBICTest/Schema/CD.pm +++ b/t/lib/DBICTest/Schema/CD.pm @@ -30,8 +30,6 @@ __PACKAGE__->add_unique_constraint([ qw/artist title/ ]); __PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist', undef, { is_deferrable => 1, - on_delete => undef, - on_update => 'SET NULL', }); __PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track' ); @@ -55,7 +53,12 @@ __PACKAGE__->many_to_many( __PACKAGE__->belongs_to('genre', 'DBICTest::Schema::Genre', { 'foreign.genreid' => 'self.genreid' }, - { join_type => 'left' }, + { + join_type => 'left', + on_delete => 'SET NULL', + on_update => 'CASCADE', + + }, ); #__PACKAGE__->add_relationship('genre', 'DBICTest::Schema::Genre', diff --git a/t/lib/DBICTest/Schema/Event.pm b/t/lib/DBICTest/Schema/Event.pm index 063df6f..0c02568 100644 --- a/t/lib/DBICTest/Schema/Event.pm +++ b/t/lib/DBICTest/Schema/Event.pm @@ -14,7 +14,7 @@ __PACKAGE__->add_columns( created_on => { data_type => 'timestamp' }, varchar_date => { data_type => 'varchar', inflate_date => 1, size => 20, is_nullable => 1 }, varchar_datetime => { data_type => 'varchar', inflate_datetime => 1, size => 20, is_nullable => 1 }, - skip_inflation => { data_type => 'datetime', inflate_datetime => 0, size => 20, is_nullable => 1 }, + skip_inflation => { data_type => 'datetime', inflate_datetime => 0, is_nullable => 1 }, ); __PACKAGE__->set_primary_key('id'); diff --git a/t/lib/sqlite.sql b/t/lib/sqlite.sql index 350398c..c4ff125 100644 --- a/t/lib/sqlite.sql +++ b/t/lib/sqlite.sql @@ -1,6 +1,6 @@ -- -- Created by SQL::Translator::Producer::SQLite --- Created on Sun Nov 2 15:27:04 2008 +-- Created on Sun Nov 9 16:28:17 2008 -- BEGIN TRANSACTION; @@ -11,7 +11,8 @@ BEGIN TRANSACTION; CREATE TABLE artist ( artistid INTEGER PRIMARY KEY NOT NULL, name varchar(100), - rank integer NOT NULL DEFAULT '13' + rank integer NOT NULL DEFAULT '13', + charfield char(10) ); @@ -118,7 +119,7 @@ CREATE TABLE event ( created_on timestamp NOT NULL, varchar_date varchar(20), varchar_datetime varchar(20), - skip_inflation datetime(20) + skip_inflation datetime );