summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2014-10-24 17:31:53 +0200
committerDavid Lawrence <dkl@mozilla.com>2014-10-24 17:31:53 +0200
commitb9465e11b70ad16a7e9a26d08efef196230f0aad (patch)
treefa8f8664a00440dbd133c5ae12003172a3123ff0 /Bugzilla
parent97ac79dcfee3a1b19a20816a31b0a79194ae75fe (diff)
downloadbugzilla-b9465e11b70ad16a7e9a26d08efef196230f0aad.tar.gz
bugzilla-b9465e11b70ad16a7e9a26d08efef196230f0aad.tar.xz
Bug 1082106 - $dbh->bz_add_columns creates a foreign key constraint
causing failure in checksetup.pl when it tries to re-add it later
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/DB.pm15
1 files changed, 11 insertions, 4 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index 183f619a5..616f4768e 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -606,8 +606,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"
@@ -621,14 +624,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;
}
@@ -2344,7 +2347,11 @@ values to.
=item C<$name> - the name of the new column
-=item C<\%definition> - Abstract column definition for the new column
+=item C<$definition> - A hashref abstract column definition for the new column.
+Note, if a C<REFERENCES> definition is included to create a foreign key
+relationship, it will be created later instead of when the column is added.
+Normally foreign keys are added by C<checksetup.pl> at the end all at the same
+time.
=item C<$init_value> (optional) - An initial value to set the column
to. Required if your column is NOT NULL and has no DEFAULT set.