another enum test for MySQL
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / lib / dbixcsl_common_tests.pm
index e8b3225..ad40057 100644 (file)
@@ -120,7 +120,7 @@ sub run_tests {
     $num_rescans++ if $self->{vendor} eq 'Firebird';
 
     plan tests => @connect_info *
-        (207 + $num_rescans * $col_accessor_map_tests + $extra_count + ($self->{data_type_tests}{test_count} || 0));
+        (209 + $num_rescans * $col_accessor_map_tests + $extra_count + ($self->{data_type_tests}{test_count} || 0));
 
     foreach my $info_idx (0..$#connect_info) {
         my $info = $connect_info[$info_idx];
@@ -588,6 +588,12 @@ sub test_schema {
     is( $class2->column_info('crumb_crisp_coating')->{accessor},  'trivet',
         'col_accessor_map is being run' );
 
+    is $class1->column_info('dat')->{is_nullable}, 0,
+        'is_nullable=0 detection';
+
+    is $class2->column_info('set_primary_key')->{is_nullable}, 1,
+        'is_nullable=1 detection';
+
     SKIP: {
         skip $self->{skip_rels}, 131 if $self->{skip_rels};
 
@@ -1113,8 +1119,10 @@ EOF
 
         find $find_cb, DUMP_DIR;
 
-#        system "rm -f /tmp/before_rescan/* /tmp/after_rescan/*";
-#        system "cp $tdir/common_dump/DBIXCSL_Test/Schema/*.pm /tmp/before_rescan";
+#        system "rm -rf /tmp/before_rescan /tmp/after_rescan";
+#        system "mkdir /tmp/before_rescan";
+#        system "mkdir /tmp/after_rescan";
+#        system "cp -a @{[DUMP_DIR]} /tmp/before_rescan";
 
         my $before_digest = $digest->b64digest;
 
@@ -1129,7 +1137,7 @@ EOF
 
         is_deeply(\@new, [ qw/LoaderTest30/ ], "Rescan");
 
-#        system "cp t/_common_dump/DBIXCSL_Test/Schema/*.pm /tmp/after_rescan";
+#        system "cp -a @{[DUMP_DIR]} /tmp/after_rescan";
 
         $digest = Digest::MD5->new;
         find $find_cb, DUMP_DIR;
@@ -1435,7 +1443,12 @@ sub create {
                 id INTEGER NOT NULL UNIQUE,
                 id1 INTEGER NOT NULL,
                 id2 INTEGER NOT NULL,
-                UNIQUE (id1, id2)
+                @{[ $self->{vendor} !~ /^(?:DB2|SQLAnywhere)\z/i ? "
+                    id3 INTEGER $self->{null},
+                    id4 INTEGER NOT NULL,
+                    UNIQUE (id3, id4),
+                " : '' ]}
+                    UNIQUE (id1, id2)
             ) $self->{innodb}
         },
     );
@@ -2117,7 +2130,7 @@ sub setup_data_type_tests {
             my @size = split /,/, $size;
 
             # some DBs don't like very long column names
-            if ($self->{vendor} =~ /^(?:firebird|sqlanywhere|oracle|db2)\z/i) {
+            if ($self->{vendor} =~ /^(?:firebird|sqlanywhere|oracle|db2|mysql)\z/i) {
                 my ($col_def, $default) = $type_alias =~ /^(.*)(default.*)?\z/i;
 
                 $type_alias = substr $col_def, 0, 15;