Use accessor for table options in MySQL producer
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Producer / MySQL.pm
index 8ec6041..1f8c541 100644 (file)
@@ -156,9 +156,7 @@ sub preprocess_schema {
       # TYPE is a synonym, but ENGINE is the preferred option name.
       #
 
-      # We have to use the hash directly here since otherwise there is no way
-      # to remove options.
-      my $options = ( $table->{options} ||= []);
+      my $options = $table->options;
 
       # If multiple option names, normalize to the first one
       if (ref $opt_name) {
@@ -612,7 +610,12 @@ sub create_field
     }
 
     # Null?
-    $field_def .= ' NOT NULL' unless $field->is_nullable;
+    if ( $field->is_nullable ) {
+        $field_def .= ' NULL';
+    }
+    else {
+        $field_def .= ' NOT NULL';
+    }
 
     # Default?
     SQL::Translator::Producer->_apply_default_value(