4 # Before `make install' is performed this script should be runnable with
5 # `make test'. After `make install' it should work as `perl test.pl'
7 # Run script with -d for debug.
14 use Test::SQL::Translator;
18 use SQL::Translator::Schema::Constants;
20 # Simple options. -d for debug
22 BEGIN { map { $opt{$_}=1 if s/^-// } @ARGV; }
23 use constant DEBUG => (exists $opt{d} ? 1 : 0);
27 #=============================================================================
30 maybe_plan(150, 'SQL::Translator::Parser::XML::SQLFairy');
33 my $testschema = "$Bin/data/xml/schema.xml";
36 $sqlt = SQL::Translator->new(
41 die "Can't find test schema $testschema" unless -e $testschema;
42 my $sql = $sqlt->translate(
43 from => 'XML-SQLFairy',
45 filename => $testschema,
46 ) or die $sqlt->error;
49 # Test the schema objs generted from the XML
51 my $scma = $sqlt->schema;
53 # Hmmm, when using schema_ok the field test data gets a bit too nested and
54 # fiddly to work with. (See 28xml-xmi-parser-sqlfairy.t for more a split out
64 mysql_table_type => "InnoDB",
70 default_value => undef,
74 is_auto_increment => 1,
75 extra => { ZEROFILL => 1 },
79 data_type => "varchar",
81 default_value => "hello",
85 name => "description",
92 data_type => "varchar",
95 default_value => undef,
104 name => "explicitnulldef",
105 data_type => "varchar",
106 default_value => undef,
110 name => "explicitemptystring",
111 data_type => "varchar",
116 name => "emptytagdef",
117 data_type => "varchar",
120 comments => "Hello emptytagdef",
134 name => 'emailuniqueindex',
141 name => "titleindex",
155 name => 'email_list',
156 sql => "SELECT email FROM Basic WHERE email IS NOT NULL",
168 name => 'foo_trigger',
169 perform_action_when => 'after',
170 database_event => 'insert',
172 action => 'update modified=timestamp();',
184 sql => 'select foo from bar',
185 parameters => ['foo', 'bar'],
187 comments => 'Go Sox!',