X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F18ttschema-producer.t;h=d4c1e935da810fddb15959b105cb2e677a35da27;hb=943ae54e805ef2205c01df65e461a879e7cbf76e;hp=9b9d8ac378e9cff914f8419a3024659d30c991bb;hpb=bced3fa710ef8ca27c8f4cec4ce4f0022e0af3dc;p=dbsrgits%2FSQL-Translator.git diff --git a/t/18ttschema-producer.t b/t/18ttschema-producer.t index 9b9d8ac..d4c1e93 100644 --- a/t/18ttschema-producer.t +++ b/t/18ttschema-producer.t @@ -16,12 +16,16 @@ use FindBin qw/$Bin/; #============================================================================= BEGIN { + eval {require Template;}; + plan skip_all => "Template v2.15 is is incompatible with SQL::Translator 0.08+" + if !$@ && Template->VERSION >= 2.15; + maybe_plan(6, 'XML::XPath', 'SQL::Translator::Parser::XML::SQLFairy', 'Template', 'Test::Differences' - ) + ); } use Test::Differences; @@ -81,7 +85,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"; } @@ -195,6 +200,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 @@ -206,7 +225,7 @@ Fields is_foreign_key: 0 foreign_key_reference: is_valid: 1 - order: 8 + order: 9 table: Basic @@ -246,3 +265,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 +