X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F10_04db2_common.t;h=e0804b882fb7095224a6ebdacb5bb2e5f9862ec9;hb=075473b9d1011fd8543989000a788f3d25015734;hp=30f12576078752cc50cd2ccafdf533be3101aea6;hpb=3b61a7ca5fade36343b5abdd11bb6b29e47e043c;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/t/10_04db2_common.t b/t/10_04db2_common.t index 30f1257..e0804b8 100644 --- a/t/10_04db2_common.t +++ b/t/10_04db2_common.t @@ -46,6 +46,8 @@ my $tester = dbixcsl_common_tests->new( null => '', preserve_case_mode_is_exclusive => 1, quote_char => '"', + default_is_deferrable => 1, + default_on_clause => 'NO ACTION', data_types => { # http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/admin/r0008483.htm # @@ -104,11 +106,41 @@ my $tester = dbixcsl_common_tests->new( # datalink => { data_type => 'datalink' }, }, extra => { - count => 30 * 2, + create => [ + # 4 through 8 are used for the multi-schema tests + q{ + create table db2_loader_test9 ( + id int generated by default as identity not null primary key + ) + }, + q{ + create table db2_loader_test10 ( + id int generated by default as identity not null primary key, + nine_id int, + foreign key (nine_id) references db2_loader_test9(id) + on delete set null on update restrict + ) + }, + ], + drop => [ qw/db2_loader_test9 db2_loader_test10/ ], + count => 4 + 30 * 2, run => sub { - SKIP: { - $schema = shift; + $schema = shift; + + # test on delete/update fk clause introspection + ok ((my $rel_info = $schema->source('Db2LoaderTest10')->relationship_info('nine')), + 'got rel info'); + + is $rel_info->{attrs}{on_delete}, 'SET NULL', + 'ON DELETE clause introspected correctly'; + is $rel_info->{attrs}{on_update}, 'RESTRICT', + 'ON UPDATE clause introspected correctly'; + + is $rel_info->{attrs}{is_deferrable}, 1, + 'DEFERRABLE defaults to 1'; + + SKIP: { my $dbh = $schema->storage->dbh; try {