Merge lp:~wgrant/launchpad/rargh-foreign-keys into lp:launchpad/db-devel

Proposed by William Grant
Status: Merged
Merged at revision: 11397
Proposed branch: lp:~wgrant/launchpad/rargh-foreign-keys
Merge into: lp:launchpad/db-devel
Diff against target: 19 lines (+15/-0)
1 file modified
database/schema/patch-2209-11-2.sql (+15/-0)
To merge this branch: bzr merge lp:~wgrant/launchpad/rargh-foreign-keys
Reviewer Review Type Date Requested Status
Stuart Bishop (community) db Approve
Robert Collins db Pending
Review via email: mp+94069@code.launchpad.net

Commit message

Add DB patch 2209-11-2 to drop foreign keys that prevent that tables dropped by 11-1 from actually being dropped.

Description of the change

I am a moron. upgrade.py drops todrop tables in undefined order, so I need to drop foreign keys between dropped tables or the post-patching replication fixup breaks. I've confirmed on a local replicated setup that this fixes both the staging (11-1 already applied but dropping failed) and production (neither already applied) cases.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

heh, doit.

Revision history for this message
Stuart Bishop (stub) wrote :

I'd blame the convoluted and obtuse system rather than the lack of foresight. And the blase db reviewer :-)

review: Approve (db)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'database/schema/patch-2209-11-2.sql'
2--- database/schema/patch-2209-11-2.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-11-2.sql 2012-02-21 23:24:23 +0000
4@@ -0,0 +1,15 @@
5+-- Copyright 2012 Canonical Ltd. This software is licensed under the
6+-- GNU Affero General Public License version 3 (see the file LICENSE).
7+
8+SET client_min_messages=ERROR;
9+
10+-- Drop foreign keys within the old access policy model so slony can
11+-- drop them out of order.
12+ALTER TABLE todrop.AccessPolicyArtifact
13+ DROP CONSTRAINT accesspolicyartifact_policy_fkey;
14+ALTER TABLE todrop.AccessPolicyGrant
15+ DROP CONSTRAINT accesspolicygrant_artifact_fkey;
16+ALTER TABLE todrop.AccessPolicyGrant
17+ DROP CONSTRAINT accesspolicygrant_policy_fkey;
18+
19+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 11, 2);

Subscribers

People subscribed via source and target branches

to status/vote changes: