summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Install/DB.pm
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-07-15 00:30:39 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-07-15 00:30:39 +0200
commite6ea9c3931636f5ebfb7877da18af28b221cdc58 (patch)
tree83537fc05c09d7480aeea0c5e21aeaeeab4c4f63 /Bugzilla/Install/DB.pm
parent0fd1b7d50b118d6f1ddaebce987e9cbd9748efa7 (diff)
downloadbugzilla-e6ea9c3931636f5ebfb7877da18af28b221cdc58.tar.gz
bugzilla-e6ea9c3931636f5ebfb7877da18af28b221cdc58.tar.xz
Bug 578739: Instead of removing REFERENCES from _bz_real_schema and then
populating FKs from _bz_schema at the end of checksetup, store REFERENCES in _bz_real_schema with a special "created => 0" key that tells us that we still need to create the FK. r=mkanat, a=mkanat (module owner)
Diffstat (limited to 'Bugzilla/Install/DB.pm')
-rw-r--r--Bugzilla/Install/DB.pm20
1 files changed, 8 insertions, 12 deletions
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index 26e36f7df..225e862de 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -3155,13 +3155,11 @@ sub _add_foreign_keys_to_multiselects {
WHERE type = ' . FIELD_TYPE_MULTI_SELECT);
foreach my $name (@$names) {
- $dbh->bz_add_fk("bug_$name", "bug_id", {TABLE => 'bugs',
- COLUMN => 'bug_id',
- DELETE => 'CASCADE',});
+ $dbh->bz_add_fk("bug_$name", "bug_id",
+ {TABLE => 'bugs', COLUMN => 'bug_id', DELETE => 'CASCADE'});
- $dbh->bz_add_fk("bug_$name", "value", {TABLE => $name,
- COLUMN => 'value',
- DELETE => 'RESTRICT',});
+ $dbh->bz_add_fk("bug_$name", "value",
+ {TABLE => $name, COLUMN => 'value', DELETE => 'RESTRICT'});
}
}
@@ -3380,9 +3378,8 @@ sub _convert_flagtypes_fks_to_set_null {
foreach my $column (qw(request_group_id grant_group_id)) {
my $fk = $dbh->bz_fk_info('flagtypes', $column);
if ($fk and !defined $fk->{DELETE}) {
- # checksetup will re-create the FK with the appropriate definition
- # at the end of its table upgrades, so we just drop it here.
- $dbh->bz_drop_fk('flagtypes', $column);
+ $fk->{DELETE} = 'SET NULL';
+ $dbh->bz_alter_fk('flagtypes', $column, $fk);
}
}
}
@@ -3398,10 +3395,9 @@ sub _fix_decimal_types {
sub _fix_series_creator_fk {
my $dbh = Bugzilla->dbh;
my $fk = $dbh->bz_fk_info('series', 'creator');
- # Change the FK from SET NULL to CASCADE. (It will be re-created
- # automatically at the end of all DB changes.)
if ($fk and $fk->{DELETE} eq 'SET NULL') {
- $dbh->bz_drop_fk('series', 'creator');
+ $fk->{DELETE} = 'CASCADE';
+ $dbh->bz_alter_fk('series', 'creator', $fk);
}
}