~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
-- Copyright 2009 Canonical Ltd.  This software is licensed under the
-- GNU Affero General Public License version 3 (see the file LICENSE).

SET client_min_messages=ERROR;

CREATE TABLE ProductSubscription (
    id serial PRIMARY KEY,
    product integer NOT NULL,
    subscriber integer NOT NULL,
    subscribed_by integer NOT NULL,
    date_created timestamp without time zone NOT NULL
        DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
    CONSTRAINT productsubscription__product__fk FOREIGN KEY (product)
        REFERENCES Product,
    CONSTRAINT productsubscription__subscriber__fk
        FOREIGN KEY (subscriber) REFERENCES Person,
    CONSTRAINT productsubscription__subscribed_by__fk
        FOREIGN KEY (subscribed_by) REFERENCES Person,
    CONSTRAINT productsubscription__product__subscriber__key
        UNIQUE (product, subscriber)
    );

CREATE INDEX productsubscription__subscriber__idx
  ON productsubscription (subscriber);

CREATE INDEX productsubscription__subscribed_by__idx
  ON productsubscription (subscribed_by);

INSERT INTO LaunchpadDatabaseRevision VALUES (87, 43, 0);