# I know this is gross but SQLite reports the size differently from release
# to release. At least this way the test still passes.
-delete $type_info->{artistid}{size};
-delete $type_info->{name}{size};
+delete $type_info->{$_}{size} for keys %$type_info;
+
my $test_type_info = {
'artistid' => {
'data_type' => 'varchar',
'is_nullable' => 0,
},
+ 'rank' => {
+ 'data_type' => 'integer',
+ 'is_nullable' => 0,
+ },
};
is_deeply($type_info, $test_type_info, 'columns_info_for - column data types');
$dbh->do("DROP TABLE IF EXISTS artist;");
-$dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), charfield CHAR(10));");
+$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));");
#'dbi:mysql:host=localhost;database=dbic_test', 'dbic_test', '');
'size' => 255,
'default_value' => undef,
},
+ 'rank' => {
+ 'data_type' => 'INT',
+ 'is_nullable' => 0,
+ 'size' => 11,
+ 'default_value' => 13,
+ },
'charfield' => {
'data_type' => 'CHAR',
'is_nullable' => 1,
CREATE TABLE artist (
artistid INT IDENTITY NOT NULL,
name VARCHAR(255),
+ 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));");
+$dbh->do("CREATE TABLE artist (artistid INT IDENTITY PRIMARY KEY, name VARCHAR(255), rank INT DEFAULT '13');");
$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');
$dbh->do("DROP TABLE IF EXISTS artist;");
-$dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), charfield CHAR(10));");
+$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));");
$schema->class('Artist')->load_components('PK::Auto');
if (exists $ENV{DBICTEST_PG_DSN}) {
($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
- $create_sql = "CREATE TABLE artist (artistid serial PRIMARY KEY, name VARCHAR(100), charfield CHAR(10))";
+ $create_sql = "CREATE TABLE artist (artistid serial PRIMARY KEY, name VARCHAR(100), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10))";
} 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), charfield CHAR(10)) ENGINE=InnoDB";
+ $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";
} else {
plan skip_all => 'Set DBICTEST_(PG|MYSQL)_DSN _USER and _PASS if you want to run savepoint tests';
}
(
artistid serial NOT NULL PRIMARY KEY,
media bytea NOT NULL,
- name varchar NULL
+ name varchar NULL,
+ rank integer NOT NULL DEFAULT '13'
);
],{ RaiseError => 1, PrintError => 1 });
}
size => 100,
is_nullable => 1,
},
+ rank => {
+ data_type => 'integer',
+ default_value => 13,
+ },
);
__PACKAGE__->set_primary_key('artistid');
--
-- Created by SQL::Translator::Producer::SQLite
--- Created on Thu Oct 9 13:12:46 2008
+-- Created on Thu Oct 9 13:44:56 2008
--
BEGIN TRANSACTION;
--
CREATE TABLE artist (
artistid INTEGER PRIMARY KEY NOT NULL,
- name varchar(100)
+ name varchar(100),
+ rank integer NOT NULL DEFAULT '13'
);