X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F18ttschema-producer.t;h=909a01511d0a96f7cd84bfc55c40a73dea723c90;hb=fd52d7dda57e532e5624ad4a512c939639d038b0;hp=5002d1e54d38c444358e2ed56f7e5090833c398e;hpb=08d91aada45b94a16f3660b5cc10384df5616ff9;p=dbsrgits%2FSQL-Translator.git diff --git a/t/18ttschema-producer.t b/t/18ttschema-producer.t index 5002d1e..909a015 100644 --- a/t/18ttschema-producer.t +++ b/t/18ttschema-producer.t @@ -16,12 +16,11 @@ use FindBin qw/$Bin/; #============================================================================= BEGIN { - maybe_plan(6, - 'XML::XPath', + maybe_plan(6, 'SQL::Translator::Parser::XML::SQLFairy', - 'Template', + 'Template 2.20', 'Test::Differences' - ) + ); } use Test::Differences; @@ -32,7 +31,7 @@ use SQL::Translator::Producer::TTSchema; { my $obj; $obj = SQL::Translator->new( - show_warnings => 1, + show_warnings => 0, from => "XML-SQLFairy", filename => "$Bin/data/xml/schema.xml", to => "TTSchema", @@ -59,7 +58,7 @@ use SQL::Translator::Producer::TTSchema; [%- END %]}; my $obj; $obj = SQL::Translator->new( - show_warnings => 1, + show_warnings => 0, from => "XML-SQLFairy", filename => "$Bin/data/xml/schema.xml", to => "TTSchema", @@ -79,7 +78,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"; } @@ -115,7 +115,7 @@ Fields is_nullable: 0 default_value: hello is_primary_key: 0 - is_unique: 0 + is_unique: 1 is_auto_increment: 0 is_foreign_key: 0 foreign_key_reference: @@ -139,7 +139,7 @@ Fields email data_type: varchar - size: 255 + size: 500 is_nullable: 1 default_value: is_primary_key: 0 @@ -193,6 +193,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 +218,7 @@ Fields is_foreign_key: 0 foreign_key_reference: is_valid: 1 - order: 8 + order: 9 table: Basic @@ -244,3 +258,78 @@ Constraints options: is_valid: 1 + very_long_index_name_on_title_field_which_should_be_truncated_for_various_rdbms + type: UNIQUE + fields: title + expression: + match_type: + reference_fields: + reference_table: + deferrable: 1 + on_delete: + on_update: + 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: 1 + table: Another + + num + data_type: numeric + size: 10,2 + is_nullable: 1 + default_value: + is_primary_key: 0 + is_unique: 0 + is_auto_increment: 0 + is_foreign_key: 0 + foreign_key_reference: + is_valid: 1 + order: 2 + 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 +