Pg views and sqlite views, patch from wreis
[dbsrgits/SQL-Translator.git] / t / 48xml-to-sqlite.t
index fd05ad4..f35846f 100644 (file)
@@ -5,6 +5,7 @@ use FindBin qw/$Bin/;
 use Test::More;
 use Test::SQL::Translator;
 use Test::Exception;
+use Test::Differences;
 use Data::Dumper;
 use SQL::Translator;
 use SQL::Translator::Schema::Constants;
@@ -34,13 +35,10 @@ my $sql = $sqlt->translate(
 
 # print ">>$sql<<\n";
 
-is($sql, << "SQL");
+eq_or_diff($sql, << "SQL");
 BEGIN TRANSACTION;
 
 
---
--- Table: Basic
---
 DROP TABLE Basic;
 CREATE TABLE Basic (
   id INTEGER PRIMARY KEY NOT NULL,
@@ -51,11 +49,23 @@ CREATE TABLE Basic (
   explicitemptystring varchar DEFAULT '',
   -- Hello emptytagdef
   emptytagdef varchar DEFAULT '',
+  another_id int(10) DEFAULT '2',
   timest timestamp
 );
 
-CREATE INDEX titleindex_Basic on Basic (title);
-CREATE UNIQUE INDEX emailuniqueindex_Basic on Basic (email);
+CREATE INDEX titleindex_Basic ON Basic (title);
+CREATE UNIQUE INDEX emailuniqueindex_Basic ON Basic (email);
+
+DROP TABLE Another;
+CREATE TABLE Another (
+  id INTEGER PRIMARY KEY NOT NULL
+);
+
+
+DROP VIEW IF EXISTS email_list;
+CREATE VIEW email_list AS
+    SELECT email FROM Basic WHERE email IS NOT NULL;
+
 
 COMMIT;
 SQL