Commit fa123953 authored by David Lawrence's avatar David Lawrence

Bug 1082106: $dbh->bz_add_columns creates a foreign key constraint causing…

Bug 1082106: $dbh->bz_add_columns creates a foreign key constraint causing failure in checksetup.pl when it tries to re-add it later r=glob,a=glob
parent 1d68680f
...@@ -581,8 +581,11 @@ sub bz_add_column { ...@@ -581,8 +581,11 @@ sub bz_add_column {
my $current_def = $self->bz_column_info($table, $name); my $current_def = $self->bz_column_info($table, $name);
if (!$current_def) { 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( 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); defined $init_value ? $self->quote($init_value) : undef);
print get_text('install_column_add', print get_text('install_column_add',
{ column => $name, table => $table }) . "\n" { column => $name, table => $table }) . "\n"
...@@ -2318,7 +2321,11 @@ values to. ...@@ -2318,7 +2321,11 @@ values to.
=item C<$name> - the name of the new column =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 =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. to. Required if your column is NOT NULL and has no DEFAULT set.
......
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