summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-12-16 00:18:52 +0100
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-12-16 00:18:52 +0100
commit7b48d43dcd9b851d7175b7506b7f4ba91ead0366 (patch)
tree887442077823c2247eec34580a36589da7ff0827 /Bugzilla
parent87bb76f2ab8c6bf488f4dee9b8f84635a5df7bf8 (diff)
downloadbugzilla-7b48d43dcd9b851d7175b7506b7f4ba91ead0366.tar.gz
bugzilla-7b48d43dcd9b851d7175b7506b7f4ba91ead0366.tar.xz
Checkin fix for bug 619016: "DEFAULT TRUE" and "DEFAULT FALSE" were no longer
getting properly translated to 1 and 0 inside of _set_nulls_sql in Bugzilla::DB::Schema.
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/DB/Schema.pm18
1 files changed, 11 insertions, 7 deletions
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index ae5db8ffe..59f99d245 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -2243,18 +2243,22 @@ sub get_alter_column_ddl {
return @statements;
}
+# Helps handle any fields that were NULL before, if we have a default,
+# when doing an ALTER COLUMN.
sub _set_nulls_sql {
my ($self, $table, $column, $new_def, $set_nulls_to) = @_;
- my $setdefault;
- # Handle any fields that were NULL before, if we have a default,
- $setdefault = $new_def->{DEFAULT} if defined $new_def->{DEFAULT};
- # But if we have a set_nulls_to, that overrides the DEFAULT
+ my $default = $new_def->{DEFAULT};
+ # If we have a set_nulls_to, that overrides the DEFAULT
# (although nobody would usually specify both a default and
# a set_nulls_to.)
- $setdefault = $set_nulls_to if defined $set_nulls_to;
+ $default = $set_nulls_to if defined $set_nulls_to;
+ if (defined $default) {
+ my $specific = $self->{db_specific};
+ $default = $specific->{$default} if exists $specific->{$default};
+ }
my @sql;
- if (defined $setdefault) {
- push(@sql, "UPDATE $table SET $column = $setdefault"
+ if (defined $default) {
+ push(@sql, "UPDATE $table SET $column = $default"
. " WHERE $column IS NULL");
}
return @sql;