Patched mysql producer to name constraints sanely
[dbsrgits/SQL-Translator.git] / t / 38-mysql-producer.t
index 798701e..03d9c60 100644 (file)
@@ -88,6 +88,11 @@ schema:
           data_type: int
           order: 1
           is_not_null: 1
+        foo2:
+          name: foo2
+          data_type: int
+          order: 2
+          is_not_null: 1
       constraints:
         - type: PRIMARY_KEY
           fields:
@@ -97,6 +102,10 @@ schema:
           type: FOREIGN_KEY
           fields: foo
           name: fk_thing
+        - reference_table: thing
+          type: FOREIGN_KEY
+          fields: foo2
+          name: fk_thing
 
 EOSCHEMA
 
@@ -119,10 +128,13 @@ my @stmts = (
 "CREATE TABLE `thing2` (
   `id` integer,
   `foo` integer,
+  `foo2` integer,
   INDEX (`id`),
   INDEX (`foo`),
+  INDEX (`foo2`),
   PRIMARY KEY (`id`, `foo`),
-  CONSTRAINT `thing2_fk_thing` FOREIGN KEY (`foo`) REFERENCES `thing` (`id`)
+  CONSTRAINT `thing2_fk_thing` FOREIGN KEY (`foo`) REFERENCES `thing` (`id`),
+  CONSTRAINT `thing2_fk_thing_1` FOREIGN KEY (`foo2`) REFERENCES `thing` (`id`)
 ) Type=InnoDB;\n\n",
 
 "SET foreign_key_checks=1;\n\n"