1
-- Copyright 2011 Canonical Ltd. This software is licensed under the
2
-- GNU Affero General Public License version 3 (see the file LICENSE).
3
SET client_min_messages=ERROR;
5
-- Make the existing primary key index think it is not the primary key.
6
UPDATE pg_index SET indisprimary = FALSE
7
WHERE pg_index.indexrelid = 'revisionnumber_pkey'::regclass;
9
UPDATE pg_constraint SET contype = 'u'
11
conrelid='branchrevision'::regclass
12
AND conname='revisionnumber_pkey';
15
-- Make an existing index think it is the primary key.
16
UPDATE pg_index SET indisprimary = TRUE
17
WHERE pg_index.indexrelid = 'revision__revision__branch__key'::regclass;
19
UPDATE pg_constraint SET contype='p'
21
conrelid='branchrevision'::regclass
22
AND conname='revision__revision__branch__key';
25
-- This view is no longer used - no need to recreate it.
26
DROP VIEW RevisionNumber;
28
ALTER TABLE BranchRevision
30
DROP CONSTRAINT revision__branch__revision__key;
32
-- Rename our new primary key index to the old name to keep Slony-I happy.
33
ALTER INDEX revision__revision__branch__key RENAME TO revisionnumber_pkey;
35
INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 62, 0);