summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB/Schema
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2016-04-28 20:32:04 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2016-04-28 20:32:04 +0200
commitacf611b178afd1bdeed8383a9647bc73a4e10d05 (patch)
treef46a5b9aafb430ee97693ef6cc70ebadd60c60b7 /Bugzilla/DB/Schema
parent86facf92f2346a817f7e7399718a66dd4fab7f8e (diff)
downloadbugzilla-acf611b178afd1bdeed8383a9647bc73a4e10d05.tar.gz
bugzilla-acf611b178afd1bdeed8383a9647bc73a4e10d05.tar.xz
Bug 1268174 - [PostgreSQL] $dbh->bz_add_column() fails to create new columns with the NOT NULL constraint if there is no DEFAULT value
r=gerv
Diffstat (limited to 'Bugzilla/DB/Schema')
-rw-r--r--Bugzilla/DB/Schema/Oracle.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/Bugzilla/DB/Schema/Oracle.pm b/Bugzilla/DB/Schema/Oracle.pm
index c3868ad44..8d237d27e 100644
--- a/Bugzilla/DB/Schema/Oracle.pm
+++ b/Bugzilla/DB/Schema/Oracle.pm
@@ -215,6 +215,11 @@ sub get_add_column_ddl {
return @sql;
}
+sub get_drop_default_ddl {
+ my ($self, $table, $column) = @_;
+ return "ALTER TABLE $table MODIFY $column DEFAULT NULL";
+}
+
sub get_alter_column_ddl {
my ($self, $table, $column, $new_def, $set_nulls_to) = @_;
@@ -240,8 +245,7 @@ sub get_alter_column_ddl {
}
# If we went from having a default to not having one
elsif (!defined $default && defined $default_old) {
- push(@statements, "ALTER TABLE $table MODIFY $column"
- . " DEFAULT NULL");
+ push(@statements, $self->get_drop_default_ddl($table, $column));
}
# If we went from no default to a default, or we changed the default.
elsif ( (defined $default && !defined $default_old) ||
@@ -524,6 +528,8 @@ sub get_set_serial_sql {
=item get_drop_column_ddl
+=item get_drop_default_ddl
+
=item get_drop_table_ddl
=item get_drop_fk_sql