diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-06-22 05:43:17 +0200 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-06-22 05:43:17 +0200 |
commit | 26120c8f04f03a3657367a412ffea085bccbcd75 (patch) | |
tree | 40e5def79e1c99ca2d8848d6e316fd71e01b1f20 /Bugzilla | |
parent | 0fa7022e791499766365c85a7b36bb4cd22a7bcc (diff) | |
download | bugzilla-26120c8f04f03a3657367a412ffea085bccbcd75.tar.gz bugzilla-26120c8f04f03a3657367a412ffea085bccbcd75.tar.xz |
When doing bz_alter_column, if
https://bugzilla.mozilla.org/show_bug.cgi?id=573441
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/DB/Schema.pm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm index 9fc507885..0791cad98 100644 --- a/Bugzilla/DB/Schema.pm +++ b/Bugzilla/DB/Schema.pm @@ -2157,6 +2157,10 @@ sub get_alter_column_ddl { my $default = $new_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. if (!defined $default && !defined $default_old) { # Do Nothing @@ -2170,7 +2174,6 @@ sub get_alter_column_ddl { elsif ( (defined $default && !defined $default_old) || ($default ne $default_old) ) { - $default = $specific->{$default} if exists $specific->{$default}; push(@statements, "ALTER TABLE $table ALTER COLUMN $column " . " SET DEFAULT $default"); } @@ -2179,7 +2182,7 @@ sub get_alter_column_ddl { if (!$old_def->{NOTNULL} && $new_def->{NOTNULL}) { my $setdefault; # 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 # (although nobody would usually specify both a default and # a set_nulls_to.) |