X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F18ttschema-producer.t;h=a9b6510dbf3b680583c1a27f3331720c0861bef3;hb=d990d84b92b2744c1546c964462230f6950dff77;hp=5002d1e54d38c444358e2ed56f7e5090833c398e;hpb=08d91aada45b94a16f3660b5cc10384df5616ff9;p=dbsrgits%2FSQL-Translator.git diff --git a/t/18ttschema-producer.t b/t/18ttschema-producer.t index 5002d1e..a9b6510 100644 --- a/t/18ttschema-producer.t +++ b/t/18ttschema-producer.t @@ -38,6 +38,7 @@ use SQL::Translator::Producer::TTSchema; to => "TTSchema", producer_args => { ttfile => "$Bin/data/template/basic.tt", +# ttfile => "$Bin/data/template/test.tt", tt_vars => { foo => 'bar', hello => 'world', @@ -46,6 +47,7 @@ use SQL::Translator::Producer::TTSchema; ); my $out; lives_ok { $out = $obj->translate; } "Translate ran"; +# print STDERR "Output: $out\n"; ok $out ne "" ,"Produced something!"; local $/ = undef; # slurp eq_or_diff $out, ,"Output looks right"; @@ -79,7 +81,8 @@ use SQL::Translator::Producer::TTSchema; ok $out ne "" ,"Produced something!"; local $/ = undef; # slurp eq_or_diff $out, q{ - Table: Basic} + Table: Basic + Table: Another} ,"Output looks right"; } @@ -193,6 +196,20 @@ Fields order: 7 table: Basic + another_id + data_type: int + size: 10 + is_nullable: 1 + default_value: 2 + is_primary_key: 0 + is_unique: 0 + is_auto_increment: 0 + is_foreign_key: 1 + foreign_key_reference: Another + is_valid: 1 + order: 8 + table: Basic + timest data_type: timestamp size: 0 @@ -204,7 +221,7 @@ Fields is_foreign_key: 0 foreign_key_reference: is_valid: 1 - order: 8 + order: 9 table: Basic @@ -244,3 +261,51 @@ Constraints options: is_valid: 1 + ? + type: FOREIGN KEY + fields: another_id + expression: + match_type: + reference_fields: id + reference_table: Another + deferrable: 1 + on_delete: + on_update: + options: + is_valid: 1 + +Table: Another +========================================================================== + +Fields + id + data_type: int + size: 10 + is_nullable: 0 + default_value: + is_primary_key: 1 + is_unique: 0 + is_auto_increment: 1 + is_foreign_key: 0 + foreign_key_reference: + is_valid: 1 + order: 10 + table: Another + + +Indices + +Constraints + ? + type: PRIMARY KEY + fields: id + expression: + match_type: + reference_fields: + reference_table: + deferrable: 1 + on_delete: + on_update: + options: + is_valid: 1 +