X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F10sqlite_common.t;h=6fe4b63dd0cb826d5bc55acc44a5e5ded2924ced;hb=38591adbae41a46ba9b1ce9e21d38404fb88f376;hp=19982e7f8781424052d3201503e9a87d35c2ec9f;hpb=62bc1e5df21ffcb34d9ce6257fd641be54a156e6;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/t/10sqlite_common.t b/t/10sqlite_common.t index 19982e7..6fe4b63 100644 --- a/t/10sqlite_common.t +++ b/t/10sqlite_common.t @@ -15,6 +15,7 @@ my $tester = dbixcsl_common_tests->new( connect_info_opts => { on_connect_do => 'PRAGMA foreign_keys = ON', }, + loader_options => { preserve_case => 1 }, data_types => { # SQLite ignores data types aside from INTEGER pks. # We just test that they roundtrip sanely. @@ -23,6 +24,10 @@ my $tester = dbixcsl_common_tests->new( 'smallint' => { data_type => 'smallint' }, 'int' => { data_type => 'int' }, 'integer' => { data_type => 'integer' }, + + # test that type name is lowercased + 'INTEGER' => { data_type => 'integer' }, + 'bigint' => { data_type => 'bigint' }, 'float' => { data_type => 'float' }, 'double precision' => @@ -46,7 +51,7 @@ my $tester = dbixcsl_common_tests->new( # Date and Time Types 'date' => { data_type => 'date' }, 'timestamp DEFAULT CURRENT_TIMESTAMP' - => { data_type => 'timestamp', default_value => \'CURRENT_TIMESTAMP' }, + => { data_type => 'timestamp', default_value => \'current_timestamp' }, 'time' => { data_type => 'time' }, # String Types @@ -88,11 +93,29 @@ my $tester = dbixcsl_common_tests->new( # make sure views are picked up q{ CREATE VIEW extra_loader_test5 AS SELECT * FROM extra_loader_test4 - } + }, + # Compound primary keys can't be autoinc in the DBIC sense + q{ + CREATE TABLE extra_loader_test6 ( + id1 INTEGER, + id2 INTEGER, + value INTEGER, + PRIMARY KEY (id1, id2) + ) + }, + q{ + CREATE TABLE extra_loader_test7 ( + id1 INTEGER, + id2 TEXT, + value DECIMAL, + PRIMARY KEY (id1, id2) + ) + }, ], pre_drop_ddl => [ 'DROP VIEW extra_loader_test5' ], - drop => [ qw/extra_loader_test1 extra_loader_test2 extra_loader_test3 extra_loader_test4 / ], - count => 9, + drop => [ qw/extra_loader_test1 extra_loader_test2 extra_loader_test3 + extra_loader_test4 extra_loader_test6 extra_loader_test7/ ], + count => 11, run => sub { my ($schema, $monikers, $classes) = @_; @@ -122,6 +145,12 @@ my $tester = dbixcsl_common_tests->new( # test that columns for views are picked up is $schema->resultset($monikers->{extra_loader_test5})->result_source->column_info('person_id')->{data_type}, 'integer', 'columns for views are introspected'; + + isnt $schema->resultset($monikers->{extra_loader_test6})->result_source->column_info('id1')->{is_auto_increment}, 1, + q{two integer PKs don't get marked autoinc}; + + isnt $schema->resultset($monikers->{extra_loader_test7})->result_source->column_info('id1')->{is_auto_increment}, 1, + q{composite integer PK with non-integer PK doesn't get marked autoinc}; }, }, );