patch from abraxxa (Alexander Hartmaier) to truncate unique constraint names that...
[dbsrgits/SQL-Translator.git] / t / 48xml-to-sqlite.t
index 60a607a..ef14da4 100644 (file)
@@ -34,8 +34,6 @@ my $sql = $sqlt->translate(
 ) or die $sqlt->error;
 
 eq_or_diff($sql, << "SQL");
-
-
 BEGIN TRANSACTION;
 
 DROP TABLE Basic;
@@ -57,6 +55,8 @@ CREATE INDEX titleindex ON Basic (title);
 
 CREATE UNIQUE INDEX emailuniqueindex ON Basic (email);
 
+CREATE UNIQUE INDEX very_long_index_name_on_title_field_which_should_be_truncated_for_various_rdbms ON Basic (title);
+
 DROP TABLE Another;
 
 CREATE TABLE Another (
@@ -65,6 +65,7 @@ CREATE TABLE Another (
 );
 
 DROP VIEW IF EXISTS email_list;
+
 CREATE VIEW email_list AS
     SELECT email FROM Basic WHERE (email IS NOT NULL);
 
@@ -92,7 +93,7 @@ my @sql = $sqlt->translate(
 
 eq_or_diff(\@sql, 
           [
-          "\n\nBEGIN TRANSACTION",
+          'BEGIN TRANSACTION',
           'DROP TABLE Basic',
           'CREATE TABLE Basic (
   id INTEGER PRIMARY KEY NOT NULL,
@@ -108,13 +109,14 @@ eq_or_diff(\@sql,
 )',
           'CREATE INDEX titleindex ON Basic (title)',
           'CREATE UNIQUE INDEX emailuniqueindex ON Basic (email)',
+          'CREATE UNIQUE INDEX very_long_index_name_on_title_field_which_should_be_truncated_for_various_rdbms ON Basic (title)',
           'DROP TABLE Another',
           'CREATE TABLE Another (
   id INTEGER PRIMARY KEY NOT NULL,
   num numeric(10,2)
 )',
-          'DROP VIEW IF EXISTS email_list;
-CREATE VIEW email_list AS
+          'DROP VIEW IF EXISTS email_list',
+          'CREATE VIEW email_list AS
     SELECT email FROM Basic WHERE (email IS NOT NULL)',
           'DROP TRIGGER IF EXISTS foo_trigger',
           'CREATE TRIGGER foo_trigger after insert on Basic BEGIN update modified=timestamp(); END',