MAss diff changes imported from Ash's local diff-refactor branch
[dbsrgits/SQL-Translator.git] / t / 39-filter-globals.t
index 4bc19c1..68fd98d 100644 (file)
@@ -17,6 +17,8 @@ BEGIN {
 use Test::Differences;
 use SQL::Translator;
 
+my $sqlt_version = $SQL::Translator::VERSION;
+
 # The _GLOBAL_ table should be removed and its fields copied onto all other
 # tables.
 my $in_yaml = qq{---
@@ -31,6 +33,10 @@ schema:
       indices:
         - fields:
             - modified
+      constraints:
+        - fields:
+            - modified
+          type: UNIQUE
     Person:
       name: Person
       fields:
@@ -39,16 +45,28 @@ schema:
           name: first_name
 };
 
+# Should include the the items added from the Global table defined above in the
+# schema as well as those defined in the filter args below.
 my $ans_yaml = qq{---
 schema:
   procedures: {}
   tables:
     Person:
-      comments: ''
-      constraints: []
+      constraints:
+        - deferrable: 1
+          expression: ''
+          fields:
+            - modified
+          match_type: ''
+          name: ''
+          on_delete: ''
+          on_update: ''
+          options: []
+          reference_fields: []
+          reference_table: ''
+          type: UNIQUE
       fields:
         created:
-          comments: ''
           data_type: timestamp
           default_value: ~
           extra: {}
@@ -60,7 +78,6 @@ schema:
           size:
             - 0
         first_name:
-          comments: ''
           data_type: foovar
           default_value: ~
           extra: {}
@@ -72,13 +89,12 @@ schema:
           size:
             - 0
         modified:
-          comments: ''
           data_type: timestamp
           default_value: ~
           extra: {}
           is_nullable: 1
           is_primary_key: 0
-          is_unique: 0
+          is_unique: 1
           name: modified
           order: 4
           size:
@@ -109,9 +125,10 @@ translator:
   producer_type: SQL::Translator::Producer::YAML
   show_warnings: 1
   trace: 0
-  version: 0.07
+  version: $sqlt_version
 };
 
+
 # Parse the test XML schema
 my $obj;
 $obj = SQL::Translator->new(