Update TODO file
[dbsrgits/SQL-Translator.git] / t / 48xml-to-sqlite.t
CommitLineData
8c4efd11 1#!/usr/bin/perl
2use strict;
3
4use FindBin qw/$Bin/;
5use Test::More;
6use Test::SQL::Translator;
7use Test::Exception;
8use Data::Dumper;
9use SQL::Translator;
10use SQL::Translator::Schema::Constants;
11
12
13BEGIN {
14 maybe_plan(1, 'SQL::Translator::Parser::XML::SQLFairy',
15 'SQL::Translator::Producer::SQLite');
16}
17
18my $xmlfile = "$Bin/data/xml/schema.xml";
19
20my $sqlt;
21$sqlt = SQL::Translator->new(
22 no_comments => 1,
23 show_warnings => 1,
24 add_drop_table => 1,
25);
26
27die "Can't find test schema $xmlfile" unless -e $xmlfile;
28
29my $sql = $sqlt->translate(
30 from => 'XML-SQLFairy',
31 to => 'SQLite',
32 filename => $xmlfile,
33) or die $sqlt->error;
34
35# print ">>$sql<<\n";
36
37is($sql, << "SQL");
38BEGIN TRANSACTION;
39
40
8c4efd11 41DROP TABLE Basic;
42CREATE TABLE Basic (
43 id INTEGER PRIMARY KEY NOT NULL,
44 title varchar(100) NOT NULL DEFAULT 'hello',
45 description text DEFAULT '',
46 email varchar(255),
47 explicitnulldef varchar,
48 explicitemptystring varchar DEFAULT '',
49 -- Hello emptytagdef
08d91aad 50 emptytagdef varchar DEFAULT '',
51 timest timestamp
8c4efd11 52);
53
54CREATE INDEX titleindex_Basic on Basic (title);
55CREATE UNIQUE INDEX emailuniqueindex_Basic on Basic (email);
56
57COMMIT;
58SQL