1
-- Copyright 2011 Canonical Ltd. This software is licensed under the
2
-- GNU Affero General Public License version 3 (see the file LICENSE).
4
SET client_min_messages=ERROR;
6
-- A table to store bug mutes in.
9
person integer REFERENCES Person(id)
10
ON DELETE CASCADE NOT NULL,
11
bug integer REFERENCES Bug(id)
12
ON DELETE CASCADE NOT NULL,
13
date_created timestamp without time zone
14
DEFAULT timezone('UTC'::text, now()) NOT NULL,
15
CONSTRAINT bugmute_pkey PRIMARY KEY (person, bug)
18
-- We don't need an index on person, as the primary key index can be used
19
-- for those lookups. We have an index on just the bug, as the bulk of our
20
-- lookups will be on bugs.
21
CREATE INDEX bugmute__bug__idx
24
-- Migrate existing BugSubscription's with
25
-- bug_notification_level == NOTHING
27
INSERT INTO BugMute (person, bug, date_created)
28
SELECT person, bug, date_created
30
WHERE bug_notification_level=10;
31
-- Remove 'muting' BugSubscriptions.
34
WHERE bug_notification_level=10;
36
INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 70, 0);