Declare dependencies in deterministic order (RT#102859)
[dbsrgits/SQL-Translator.git] / t / 38-mysql-producer.t
index 45752f6..446186b 100644 (file)
@@ -67,6 +67,20 @@ schema:
             mysql_charset: utf8
             mysql_collate: utf8_general_ci
           order: 4
+        timestamp:
+          data_type: timestamp
+          default_value: !!perl/ref
+            =: CURRENT_TIMESTAMP
+          extra:
+            on update: !!perl/ref
+              =: CURRENT_TIMESTAMP
+          is_nullable: 1
+          is_primary_key: 0
+          is_unique: 0
+          name: timestamp
+          order: 5
+          size:
+            - 0
       constraints:
         - type: UNIQUE
           fields:
@@ -103,7 +117,7 @@ schema:
             list:
               - foo
               - bar
-              - baz
+              - ba'z
       indices:
         - type: NORMAL
           fields:
@@ -157,7 +171,7 @@ schema:
             list:
               - foo
               - bar
-              - baz
+              - ba'z
       indices:
         - type: NORMAL
           fields:
@@ -187,20 +201,21 @@ my @stmts = (
 
 "DROP TABLE IF EXISTS `thing`",
 "CREATE TABLE `thing` (
-  `id` unsigned int NULL auto_increment,
+  `id` unsigned int NOT NULL auto_increment,
   `name` varchar(32) NULL,
   `swedish_name` varchar(32) character set swe7 NULL,
   `description` text character set utf8 collate utf8_general_ci NULL,
+  `timestamp` timestamp on update CURRENT_TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
   PRIMARY KEY (`id`),
   UNIQUE `idx_unique_name` (`name`)
 ) ENGINE=InnoDB DEFAULT CHARACTER SET latin1 COLLATE latin1_danish_ci",
 
 "DROP TABLE IF EXISTS `some`.`thing2`",
 "CREATE TABLE `some`.`thing2` (
-  `id` integer NULL,
-  `foo` integer NULL,
+  `id` integer NOT NULL,
+  `foo` integer NOT NULL,
   `foo2` integer NULL,
-  `bar_set` set('foo', 'bar', 'baz') NULL,
+  `bar_set` set('foo', 'bar', 'ba''z') NULL,
   INDEX `index_1` (`id`),
   INDEX `really_long_name_bigger_than_64_chars_aaaaaaaaaaaaaaaaa_aed44c47` (`id`),
   INDEX (`foo`),
@@ -212,10 +227,10 @@ my @stmts = (
 
 "DROP TABLE IF EXISTS `some`.`thing3`",
 "CREATE TABLE `some`.`thing3` (
-  `id` integer NULL,
-  `foo` integer NULL,
+  `id` integer NOT NULL,
+  `foo` integer NOT NULL,
   `foo2` integer NULL,
-  `bar_set` set('foo', 'bar', 'baz') NULL,
+  `bar_set` set('foo', 'bar', 'ba''z') NULL,
   INDEX `index_1` (`id`),
   INDEX `really_long_name_bigger_than_64_chars_aaaaaaaaaaaaaaaaa_aed44c47` (`id`),
   INDEX (`foo`),