#=============================================================================
BEGIN {
+ eval {require Template;};
+
+ if ( $@ ) {
+ plan skip_all => 'Template not installed?'
+ }
+
maybe_plan(6,
'XML::XPath',
'SQL::Translator::Parser::XML::SQLFairy',
'Template',
'Test::Differences'
- )
+ );
}
use Test::Differences;
{
my $obj;
$obj = SQL::Translator->new(
- show_warnings => 1,
+ show_warnings => 0,
from => "XML-SQLFairy",
filename => "$Bin/data/xml/schema.xml",
to => "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",
ok $out ne "" ,"Produced something!";
local $/ = undef; # slurp
eq_or_diff $out, q{
- Table: Basic}
+ Table: Basic
+ Table: Another}
,"Output looks right";
}
email
data_type: varchar
- size: 255
+ size: 500
is_nullable: 1
default_value:
is_primary_key: 0
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
+ 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: 9
+ table: Basic
+
Indices
titleindex
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
+
+
+Indices
+
+Constraints
+ ?
+ type: PRIMARY KEY
+ fields: id
+ expression:
+ match_type:
+ reference_fields:
+ reference_table:
+ deferrable: 1
+ on_delete:
+ on_update:
+ options:
+ is_valid: 1
+