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(
$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', '');
'name' => {
'data_type' => 'VARCHAR',
'is_nullable' => 1,
- 'size' => 255,
+ 'size' => 100,
'default_value' => undef,
},
'rank' => {
$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)
$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');
'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,
},
],
$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');
} 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';
}
$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 });
}
data_type => 'integer',
default_value => 13,
},
+ charfield => {
+ data_type => 'char',
+ size => 10,
+ is_nullable => 1,
+ },
);
__PACKAGE__->set_primary_key('artistid');
__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' );
__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',
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');
--
-- 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;
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)
);
created_on timestamp NOT NULL,
varchar_date varchar(20),
varchar_datetime varchar(20),
- skip_inflation datetime(20)
+ skip_inflation datetime
);