- return {} if $old_column->null eq $new_column->null;
- { 'sql_alter_null' =>
- "ALTER TABLE $table MODIFY $new_def",
- };
+ my %canonical_length = (
+ 'INT' => 11,
+ 'BIGINT' => 20,
+ 'DECIMAL' => '10,0',
+ );
+ $new_column->length( $canonical_length{uc($new_column->type)} )
+ if $canonical_length{uc($new_column->type)}
+ && ($new_column->length||'') eq '';
+
+ #change type/length
+ if ( uc($old_column->type) ne uc($new_column->type)
+ || ($old_column->length||'') ne ($new_column->length||'')
+ )
+ {
+ my $old_def = $old_column->line($dbh);
+ $hashref->{'sql_alter_type'} =
+ "ALTER TABLE $table CHANGE $old_name $new_def";
+ }