Commit 6449a442 authored by Max Kanat-Alexander's avatar Max Kanat-Alexander

The DB::Schema alter_column default fix also needed to be separately

applied to DB::Schema::Oracle, since it has a full override of get_alter_column_ddl. https://bugzilla.mozilla.org/show_bug.cgi?id=573441
parent 902404f7
...@@ -214,6 +214,10 @@ sub get_alter_column_ddl { ...@@ -214,6 +214,10 @@ sub get_alter_column_ddl {
my $default = $new_def->{DEFAULT}; my $default = $new_def->{DEFAULT};
my $default_old = $old_def->{DEFAULT}; my $default_old = $old_def->{DEFAULT};
if (defined $default) {
$default = $specific->{$default} if exists $specific->{$default};
}
# This first condition prevents "uninitialized value" errors. # This first condition prevents "uninitialized value" errors.
if (!defined $default && !defined $default_old) { if (!defined $default && !defined $default_old) {
# Do Nothing # Do Nothing
...@@ -227,7 +231,6 @@ sub get_alter_column_ddl { ...@@ -227,7 +231,6 @@ sub get_alter_column_ddl {
elsif ( (defined $default && !defined $default_old) || elsif ( (defined $default && !defined $default_old) ||
($default ne $default_old) ) ($default ne $default_old) )
{ {
$default = $specific->{$default} if exists $specific->{$default};
push(@statements, "ALTER TABLE $table MODIFY $column " push(@statements, "ALTER TABLE $table MODIFY $column "
. " DEFAULT $default"); . " DEFAULT $default");
} }
...@@ -236,7 +239,7 @@ sub get_alter_column_ddl { ...@@ -236,7 +239,7 @@ sub get_alter_column_ddl {
if (!$old_def->{NOTNULL} && $new_def->{NOTNULL}) { if (!$old_def->{NOTNULL} && $new_def->{NOTNULL}) {
my $setdefault; my $setdefault;
# Handle any fields that were NULL before, if we have a default, # Handle any fields that were NULL before, if we have a default,
$setdefault = $new_def->{DEFAULT} if exists $new_def->{DEFAULT}; $setdefault = $default if defined $default;
# But if we have a set_nulls_to, that overrides the DEFAULT # But if we have a set_nulls_to, that overrides the DEFAULT
# (although nobody would usually specify both a default and # (although nobody would usually specify both a default and
# a set_nulls_to.) # a set_nulls_to.)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment