diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-03-16 06:43:16 +0100 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-03-16 06:43:16 +0100 |
commit | a41f75ddfe91e2da353caa2fcf6afba7b5ee2ca6 (patch) | |
tree | 63d8a7b1b9ad80591c70aec86e1e6817f0893ad1 /Bugzilla | |
parent | 0ee52e9d7d307d6ceed73a53de1a64589bb79f62 (diff) | |
download | bugzilla-a41f75ddfe91e2da353caa2fcf6afba7b5ee2ca6.tar.gz bugzilla-a41f75ddfe91e2da353caa2fcf6afba7b5ee2ca6.tar.xz |
Bug 545770: Make contrib/merge-users.pl figure out what columns to merge
by tracing FKs instead of having a fixed list.
r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/DB.pm | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm index 830d2835e..85ad77e17 100644 --- a/Bugzilla/DB.pm +++ b/Bugzilla/DB.pm @@ -754,10 +754,10 @@ sub bz_drop_fk { } -sub bz_drop_related_fks { +sub bz_get_related_fks { my ($self, $table, $column) = @_; my @tables = $self->_bz_real_schema->get_table_list(); - my @dropped; + my @related; foreach my $check_table (@tables) { my @columns = $self->bz_table_columns($check_table); foreach my $check_column (@columns) { @@ -767,13 +767,22 @@ sub bz_drop_related_fks { and (($fk->{TABLE} eq $table and $fk->{COLUMN} eq $column) or ($check_column eq $column and $check_table eq $table))) { - $self->bz_drop_fk($check_table, $check_column); - push(@dropped, [$check_table, $check_column, $fk]); + push(@related, [$check_table, $check_column, $fk]); } } # foreach $column } # foreach $table - return \@dropped; + return \@related; +} + +sub bz_drop_related_fks { + my $self = shift; + my $related = $self->bz_get_related_fks(@_); + foreach my $item (@$related) { + my ($table, $column) = @$item; + $self->bz_drop_fk($table, $column); + } + return $related; } sub bz_drop_index { |