Commit 7b48d43d authored by Max Kanat-Alexander's avatar Max Kanat-Alexander

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.
parent 87bb76f2
...@@ -2243,18 +2243,22 @@ sub get_alter_column_ddl { ...@@ -2243,18 +2243,22 @@ sub get_alter_column_ddl {
return @statements; return @statements;
} }
# Helps handle any fields that were NULL before, if we have a default,
# when doing an ALTER COLUMN.
sub _set_nulls_sql { sub _set_nulls_sql {
my ($self, $table, $column, $new_def, $set_nulls_to) = @_; my ($self, $table, $column, $new_def, $set_nulls_to) = @_;
my $setdefault; my $default = $new_def->{DEFAULT};
# Handle any fields that were NULL before, if we have a default, # If we have a set_nulls_to, that overrides the DEFAULT
$setdefault = $new_def->{DEFAULT} if defined $new_def->{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.)
$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; my @sql;
if (defined $setdefault) { if (defined $default) {
push(@sql, "UPDATE $table SET $column = $setdefault" push(@sql, "UPDATE $table SET $column = $default"
. " WHERE $column IS NULL"); . " WHERE $column IS NULL");
} }
return @sql; return @sql;
......
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