aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2014-12-11 15:13:13 +0000
committerGervase Markham <gerv@gerv.net>2014-12-11 15:13:13 +0000
commit89b7de1363b5d185633596c874e1998adb526c91 (patch)
tree6b7f9d2a2c5bf3530c9443c77e9cefcfd96fd03f
parent440747989c61507859c27fba5fe44a2a7afb1103 (diff)
downloadbugs-89b7de1363b5d185633596c874e1998adb526c91.tar
bugs-89b7de1363b5d185633596c874e1998adb526c91.tar.gz
bugs-89b7de1363b5d185633596c874e1998adb526c91.tar.bz2
bugs-89b7de1363b5d185633596c874e1998adb526c91.tar.xz
bugs-89b7de1363b5d185633596c874e1998adb526c91.zip
Bug 1082106 - avoid problem where ->bz_add_columns creates a foreign key constraint causing failure in checksetup.pl when it tries to re-add it later. r,a=glob
-rw-r--r--Bugzilla/DB.pm9
1 files changed, 6 insertions, 3 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index 29f431b12..c9eaf6e9e 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -581,8 +581,11 @@ sub bz_add_column {
my $current_def = $self->bz_column_info($table, $name);
if (!$current_def) {
+ # REFERENCES need to happen later and not be created right away
+ my $trimmed_def = dclone($new_def);
+ delete $trimmed_def->{REFERENCES};
my @statements = $self->_bz_real_schema->get_add_column_ddl(
- $table, $name, $new_def,
+ $table, $name, $trimmed_def,
defined $init_value ? $self->quote($init_value) : undef);
print get_text('install_column_add',
{ column => $name, table => $table }) . "\n"
@@ -596,14 +599,14 @@ sub bz_add_column {
# column exists there and has a REFERENCES item.
# bz_setup_foreign_keys will then add this FK at the end of
# Install::DB.
- my $col_abstract =
+ my $col_abstract =
$self->_bz_schema->get_column_abstract($table, $name);
if (exists $col_abstract->{REFERENCES}) {
my $new_fk = dclone($col_abstract->{REFERENCES});
$new_fk->{created} = 0;
$new_def->{REFERENCES} = $new_fk;
}
-
+
$self->_bz_real_schema->set_column($table, $name, $new_def);
$self->_bz_store_real_schema;
}