~launchpad-pqm/launchpad/devel

12552.2.2 by Raphaël Badin
Added sql change patch (add registrant field to distribution).
1
-- Copyright 2009 Canonical Ltd.  This software is licensed under the
2
-- GNU Affero General Public License version 3 (see the file LICENSE).
3
4
SET client_min_messages=ERROR;
5
12552.2.5 by Raphaël Badin
Added migration code to set registrants for existing distros to ~registry.
6
-- Add a registrant column to distributions.
12552.2.2 by Raphaël Badin
Added sql change patch (add registrant field to distribution).
7
ALTER TABLE Distribution
8
    ADD COLUMN registrant integer REFERENCES Person;
9
7675.1066.9 by Raphael Badin
Set registrant to owner for existing distros.
10
-- Set registrant to owner for existing distros.
12552.2.5 by Raphaël Badin
Added migration code to set registrants for existing distros to ~registry.
11
update Distribution
7675.1066.9 by Raphael Badin
Set registrant to owner for existing distros.
12
    SET registrant = owner;
12552.2.5 by Raphaël Badin
Added migration code to set registrants for existing distros to ~registry.
13
14
-- Add NOT NULL constraint to registrant column.
7675.1066.8 by Raphael Badin
Fixed sql patch. Used stub's patch number (53).
15
ALTER TABLE Distribution ALTER COLUMN registrant SET NOT NULL;
16
17
-- Add index to registrant column.
18
CREATE INDEX distribution__registrant__idx ON Distribution(registrant);
19
20
INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 53, 0);