6 use Test::SQL::Translator;
11 use SQL::Translator::Schema::Constants;
15 maybe_plan(1, 'SQL::Translator::Parser::XML::SQLFairy',
16 'SQL::Translator::Producer::SQLite');
19 my $xmlfile = "$Bin/data/xml/schema.xml";
22 $sqlt = SQL::Translator->new(
28 die "Can't find test schema $xmlfile" unless -e $xmlfile;
30 my $sql = $sqlt->translate(
31 from => 'XML-SQLFairy',
34 ) or die $sqlt->error;
38 eq_or_diff($sql, << "SQL");
44 id INTEGER PRIMARY KEY NOT NULL,
45 title varchar(100) NOT NULL DEFAULT 'hello',
46 description text DEFAULT '',
48 explicitnulldef varchar,
49 explicitemptystring varchar DEFAULT '',
51 emptytagdef varchar DEFAULT '',
52 another_id int(10) DEFAULT '2',
56 CREATE INDEX titleindex_Basic ON Basic (title);
57 CREATE UNIQUE INDEX emailuniqueindex_Basic ON Basic (email);
60 CREATE TABLE Another (
61 id INTEGER PRIMARY KEY NOT NULL
65 DROP VIEW IF EXISTS email_list;
66 CREATE VIEW email_list AS
67 SELECT email FROM Basic WHERE email IS NOT NULL;