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(142, '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 default_value => undef,
68 is_auto_increment => 1,
72 data_type => "varchar",
74 default_value => "hello",
78 name => "description",
85 data_type => "varchar",
88 default_value => undef,
92 name => "explicitnulldef",
93 data_type => "varchar",
94 default_value => undef,
98 name => "explicitemptystring",
99 data_type => "varchar",
104 name => "emptytagdef",
105 data_type => "varchar",
116 name => 'emailuniqueindex',
123 name => "titleindex",
132 name => 'email_list',
133 sql => "SELECT email FROM Basic WHERE email IS NOT NULL",
140 name => 'foo_trigger',
141 perform_action_when => 'after',
142 database_event => 'insert',
144 action => 'update modified=timestamp();',
151 sql => 'select foo from bar',
152 parameters => ['foo', 'bar'],
154 comments => 'Go Sox!',