no DEFAULT for mysql, patch from trs@bestpractical, CPAN#58505
[DBIx-DBSchema.git] / DBSchema / DBD / mysql.pm
index 798ea43..07d341a 100644 (file)
@@ -139,6 +139,15 @@ sub column_callback {
 
   }
 
+  # MySQL no longer supports defaults for text/blob columns
+  if ( $column_obj->type =~ /(TEXT|BLOB)/i
+       and defined $column_obj->default ) {
+
+    # There's no way to unset the default cleanly.
+    # An empty string isn't quite right.
+    $column_obj->{'default'} = undef;
+  }
+
   $hashref;
 
 }
@@ -177,7 +186,7 @@ sub alter_column_callback {
   {
     my $old_def = $old_column->line($dbh);
     $hashref->{'sql_alter_type'} =
-      "ALTER TABLE $table CHANGE $old_name $new_def";
+      "CHANGE $old_name $new_def";
   }
 
   #change nullability
@@ -197,7 +206,7 @@ Ivan Kohler <ivan-dbix-dbschema@420.am>
 
 Copyright (c) 2000 Ivan Kohler
 Copyright (c) 2000 Mail Abuse Prevention System LLC
-Copyright (c) 2007-2011 Freeside Internet Services, Inc.
+Copyright (c) 2007-2013 Freeside Internet Services, Inc.
 All rights reserved.
 This program is free software; you can redistribute it and/or modify it under
 the same terms as Perl itself.