14186.5.1
by William Grant
Add PillarObserver(Policy|Artifact|Permission) tables. |
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; |
|
4 |
||
14186.5.12
by William Grant
AccessPolicy->AccessPolicyType (enum), AccessPolicyUse->AccessPolicy again. |
5 |
CREATE TABLE AccessPolicy ( |
14186.5.1
by William Grant
Add PillarObserver(Policy|Artifact|Permission) tables. |
6 |
id serial PRIMARY KEY, |
7 |
product integer REFERENCES Product, |
|
8 |
distribution integer REFERENCES Distribution, |
|
14186.5.14
by William Grant
AccessPolicy.type is mandatory. AccessPolicyArtifact.policy is optional (may be public). |
9 |
type integer NOT NULL, |
14186.5.11
by William Grant
Renormalise schema after extensive performance experiments. APA.policy_use exists, APG.(policy_use|artifact) are mutually exclusive. |
10 |
CONSTRAINT has_target CHECK (product IS NULL != distribution IS NULL) |
14186.5.1
by William Grant
Add PillarObserver(Policy|Artifact|Permission) tables. |
11 |
);
|
12 |
||
14186.5.12
by William Grant
AccessPolicy->AccessPolicyType (enum), AccessPolicyUse->AccessPolicy again. |
13 |
CREATE UNIQUE INDEX accesspolicy__product__type__key |
14 |
ON AccessPolicy(product, type) WHERE product IS NOT NULL; |
|
15 |
CREATE UNIQUE INDEX accesspolicy__distribution__type__key |
|
16 |
ON AccessPolicy(distribution, type) WHERE distribution IS NOT NULL; |
|
14186.5.10
by William Grant
Partialify some indices, and add one on AccessPolicyGrant(person). |
17 |
|
14186.5.3
by William Grant
PillarObserverPolicy is now AccessPolicy. |
18 |
CREATE TABLE AccessPolicyArtifact ( |
14186.5.1
by William Grant
Add PillarObserver(Policy|Artifact|Permission) tables. |
19 |
id serial PRIMARY KEY, |
20 |
bug integer REFERENCES Bug, |
|
14186.5.21
by William Grant
Drop branch FK as well. |
21 |
branch integer, -- FK to be added later. |
14186.5.14
by William Grant
AccessPolicy.type is mandatory. AccessPolicyArtifact.policy is optional (may be public). |
22 |
policy integer REFERENCES AccessPolicy, |
14186.5.1
by William Grant
Add PillarObserver(Policy|Artifact|Permission) tables. |
23 |
CONSTRAINT has_artifact CHECK (bug IS NULL != branch IS NULL) |
24 |
);
|
|
25 |
||
14186.5.10
by William Grant
Partialify some indices, and add one on AccessPolicyGrant(person). |
26 |
CREATE UNIQUE INDEX accesspolicyartifact__bug__key |
14186.5.17
by William Grant
Fix indices. |
27 |
ON AccessPolicyArtifact(bug) WHERE bug IS NOT NULL; |
14186.5.10
by William Grant
Partialify some indices, and add one on AccessPolicyGrant(person). |
28 |
CREATE UNIQUE INDEX accesspolicyartifact__branch__key |
14186.5.17
by William Grant
Fix indices. |
29 |
ON AccessPolicyArtifact(branch) WHERE branch IS NOT NULL; |
14186.5.12
by William Grant
AccessPolicy->AccessPolicyType (enum), AccessPolicyUse->AccessPolicy again. |
30 |
CREATE INDEX accesspolicyartifact__policy__key |
31 |
ON AccessPolicyArtifact(policy); |
|
14186.5.10
by William Grant
Partialify some indices, and add one on AccessPolicyGrant(person). |
32 |
|
14186.5.8
by William Grant
permission -> grant, by review. |
33 |
CREATE TABLE AccessPolicyGrant ( |
14186.5.1
by William Grant
Add PillarObserver(Policy|Artifact|Permission) tables. |
34 |
id serial PRIMARY KEY, |
14186.5.21
by William Grant
Drop branch FK as well. |
35 |
grantee integer NOT NULL, -- FK to be added later. |
36 |
grantor integer NOT NULL, -- FK to be added later. |
|
14186.5.11
by William Grant
Renormalise schema after extensive performance experiments. APA.policy_use exists, APG.(policy_use|artifact) are mutually exclusive. |
37 |
date_created timestamp without time zone |
38 |
DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL, |
|
14186.5.16
by William Grant
Reorder. |
39 |
policy integer REFERENCES AccessPolicy, |
40 |
artifact integer REFERENCES AccessPolicyArtifact, |
|
14186.5.12
by William Grant
AccessPolicy->AccessPolicyType (enum), AccessPolicyUse->AccessPolicy again. |
41 |
CONSTRAINT has_target CHECK (policy IS NULL != artifact IS NULL) |
14186.5.1
by William Grant
Add PillarObserver(Policy|Artifact|Permission) tables. |
42 |
);
|
43 |
||
14186.5.15
by William Grant
APG.person -> grantee, creator -> grantor. |
44 |
CREATE UNIQUE INDEX accesspolicygrant__policy__grantee__key |
45 |
ON AccessPolicyGrant(policy, grantee) WHERE policy IS NOT NULL; |
|
46 |
CREATE UNIQUE INDEX accessartifactgrant__artifact__grantee__key |
|
47 |
ON AccessPolicyGrant(artifact, grantee) WHERE artifact IS NOT NULL; |
|
48 |
CREATE INDEX accesspolicygrant__grantee__idx ON AccessPolicyGrant(grantee); |
|
14186.5.18
by William Grant
Index APG.grantor to keep person merge happy. |
49 |
CREATE INDEX accesspolicygrant__grantor__idx ON AccessPolicyGrant(grantor); |
14186.5.1
by William Grant
Add PillarObserver(Policy|Artifact|Permission) tables. |
50 |
|
14186.5.2
by William Grant
References and indices on bug/branch. |
51 |
ALTER TABLE bug |
14186.5.12
by William Grant
AccessPolicy->AccessPolicyType (enum), AccessPolicyUse->AccessPolicy again. |
52 |
ADD COLUMN access_policy integer REFERENCES AccessPolicy; |
53 |
CREATE INDEX bug__access_policy__idx ON bug(access_policy); |
|
14186.5.2
by William Grant
References and indices on bug/branch. |
54 |
|
55 |
ALTER TABLE branch |
|
14186.5.12
by William Grant
AccessPolicy->AccessPolicyType (enum), AccessPolicyUse->AccessPolicy again. |
56 |
ADD COLUMN access_policy integer REFERENCES AccessPolicy; |
57 |
CREATE INDEX branch__access_policy__idx ON branch(access_policy); |
|
14186.5.2
by William Grant
References and indices on bug/branch. |
58 |
|
14186.5.6
by William Grant
Real number. |
59 |
INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 93, 1); |