Skip to content

Commit

Permalink
Some testdb changes and alignment, preparing for test refactor branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ribasushi committed Nov 9, 2008
1 parent a085381 commit a0dd867
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 20 deletions.
4 changes: 2 additions & 2 deletions t/66relationship.t
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions t/71mysql.t
Expand Up @@ -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', '');

Expand Down Expand Up @@ -57,7 +57,7 @@ my $test_type_info = {
'name' => {
'data_type' => 'VARCHAR',
'is_nullable' => 1,
'size' => 255,
'size' => 100,
'default_value' => undef,
},
'rank' => {
Expand Down
2 changes: 1 addition & 1 deletion t/746mssql.t
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion t/74mssql.t
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion t/86sqlt.t
Expand Up @@ -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,
},
],

Expand Down
2 changes: 1 addition & 1 deletion t/93nobindvars.t
Expand Up @@ -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');

Expand Down
2 changes: 1 addition & 1 deletion t/98savepoints.t
Expand Up @@ -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';
}
Expand Down
9 changes: 5 additions & 4 deletions t/bindtype_columns.t
Expand Up @@ -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 });
}
Expand Down
5 changes: 5 additions & 0 deletions t/lib/DBICTest/Schema/Artist.pm
Expand Up @@ -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');

Expand Down
9 changes: 6 additions & 3 deletions t/lib/DBICTest/Schema/CD.pm
Expand Up @@ -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' );
Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion t/lib/DBICTest/Schema/Event.pm
Expand Up @@ -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');
Expand Down
7 changes: 4 additions & 3 deletions 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;

Expand All @@ -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)
);


Expand Down Expand Up @@ -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
);


Expand Down

0 comments on commit a0dd867

Please sign in to comment.