Merge lp:~frankban/launchpad/db-milestonetags-480123 into lp:launchpad/db-devel

Proposed by Francesco Banconi
Status: Merged
Approved by: Francesco Banconi
Approved revision: no longer in the source branch.
Merged at revision: 11239
Proposed branch: lp:~frankban/launchpad/db-milestonetags-480123
Merge into: lp:launchpad/db-devel
Diff against target: 183 lines (+54/-2)
5 files modified
database/sampledata/current-dev.sql (+8/-1)
database/sampledata/current.sql (+8/-1)
database/schema/comments.sql (+5/-0)
database/schema/patch-2209-00-3.sql (+22/-0)
database/schema/security.cfg (+11/-0)
To merge this branch: bzr merge lp:~frankban/launchpad/db-milestonetags-480123
Reviewer Review Type Date Requested Status
Stuart Bishop (community) db Approve
j.c.sackett (community) Approve
Robert Collins Pending
Review via email: mp+85876@code.launchpad.net

Commit message

[r=jcsackett,stub] MilestoneTag table with fixed database permissions.

Description of the change

= Summary =

This patch introduces a new milestonetag table that will allow milestones aggregation (see bug 904335).

== Proposed fix ==

Add a milestonetag table referencing milestones.

== Pre-implementation notes ==

After long debate with Gary Poster and Brad Crittenden, we decided to introduce the concept of milestone tags, as a way to aggregate milestones.
Having milestone tags we can meet the Linaro needs, allowing them to filter specifications and bugs in a orthogonal way.
The table structure reflects what is already present in the bug tags implementation.

== Tests ==

No specific tests for the new table are actually present.
Tests passed for db-devel branch.

To post a comment you must log in.
Revision history for this message
Francis J. Lacoste (flacoste) wrote :

Should we add a date_created and creator attributes? That always convenient for auditing purpose later on? (Who added that tag.)

On the other hand, we don't have this on BugTag, but then again, we probably should.

Revision history for this message
Francesco Banconi (frankban) wrote :

Good idea. Changes done.

Revision history for this message
j.c.sackett (jcsackett) wrote :

I think this looks good; as a totally nitpicky thing I might have gone with created_by rather than creator, but I don't think in practice that will matter. If you like that, feel free to change it, but it's not a blocker to approval.

review: Approve
Revision history for this message
Francesco Banconi (frankban) wrote :

I like "created_by" more too. Changed.

Revision history for this message
Stuart Bishop (stub) wrote :

This index is redundant, as the UNIQUE constraint creates an implicit index that is just as useful.:

+CREATE INDEX milestonetag__tags_idx ON milestonetag (tag);

Otherwise, all looks just fine. It is good to land once you remove that index from the patch.

review: Approve (db)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'database/sampledata/current-dev.sql'
2--- database/sampledata/current-dev.sql 2011-12-19 05:29:36 +0000
3+++ database/sampledata/current-dev.sql 2011-12-19 16:42:25 +0000
4@@ -1,6 +1,6 @@
5 -- Copyright 2010-2011 Canonical Ltd. This software is licensed under the
6 -- GNU Affero General Public License version 3 (see the file LICENSE).
7--- Created using pg_dump (PostgreSQL) 8.4.8
8+-- Created using pg_dump (PostgreSQL) 8.4.9
9
10 SET check_function_bodies = false;
11 SET client_encoding = 'UTF8';
12@@ -5752,6 +5752,13 @@
13 ALTER TABLE messagechunk ENABLE TRIGGER ALL;
14
15
16+ALTER TABLE milestonetag DISABLE TRIGGER ALL;
17+
18+
19+
20+ALTER TABLE milestonetag ENABLE TRIGGER ALL;
21+
22+
23 ALTER TABLE mirror DISABLE TRIGGER ALL;
24
25
26
27=== modified file 'database/sampledata/current.sql'
28--- database/sampledata/current.sql 2011-12-19 05:29:36 +0000
29+++ database/sampledata/current.sql 2011-12-19 16:42:25 +0000
30@@ -1,6 +1,6 @@
31 -- Copyright 2010-2011 Canonical Ltd. This software is licensed under the
32 -- GNU Affero General Public License version 3 (see the file LICENSE).
33--- Created using pg_dump (PostgreSQL) 8.4.8
34+-- Created using pg_dump (PostgreSQL) 8.4.9
35
36 SET check_function_bodies = false;
37 SET client_encoding = 'UTF8';
38@@ -5682,6 +5682,13 @@
39 ALTER TABLE messagechunk ENABLE TRIGGER ALL;
40
41
42+ALTER TABLE milestonetag DISABLE TRIGGER ALL;
43+
44+
45+
46+ALTER TABLE milestonetag ENABLE TRIGGER ALL;
47+
48+
49 ALTER TABLE mirror DISABLE TRIGGER ALL;
50
51
52
53=== modified file 'database/schema/comments.sql'
54--- database/schema/comments.sql 2011-12-19 05:29:36 +0000
55+++ database/schema/comments.sql 2011-12-19 16:42:25 +0000
56@@ -2425,3 +2425,8 @@
57 'OpenId Identifiers that can be used to log into an Account.';
58 COMMENT ON COLUMN OpenIdIdentifier.identifier IS
59 'OpenId Identifier. This should be a URL, but is currently just a token that can be used to generate the Identity URL for the Canonical SSO OpenId Provider.';
60+
61+-- MilestoneTag
62+COMMENT ON TABLE milestonetag IS 'Attaches simple text tags to a milestone.';
63+COMMENT ON COLUMN milestonetag.milestone IS 'The milestone the tag is attached to.';
64+COMMENT ON COLUMN milestonetag.tag IS 'The text representation of the tag.';
65
66=== added file 'database/schema/patch-2209-00-3.sql'
67--- database/schema/patch-2209-00-3.sql 1970-01-01 00:00:00 +0000
68+++ database/schema/patch-2209-00-3.sql 2011-12-19 16:42:25 +0000
69@@ -0,0 +1,22 @@
70+-- Copyright 2011 Canonical Ltd. This software is licensed under the
71+-- GNU Affero General Public License version 3 (see the file LICENSE).
72+
73+SET client_min_messages=ERROR;
74+
75+CREATE TABLE milestonetag (
76+ id SERIAL PRIMARY KEY,
77+ milestone integer NOT NULL REFERENCES milestone ON DELETE CASCADE,
78+ tag text NOT NULL,
79+ date_created timestamp without time zone DEFAULT
80+ timezone('UTC'::text, now()) NOT NULL,
81+ created_by integer NOT NULL REFERENCES person,
82+ CONSTRAINT valid_tag CHECK (valid_name(tag))
83+);
84+
85+ALTER TABLE ONLY milestonetag
86+ ADD CONSTRAINT milestonetag__tag__milestone__key UNIQUE (tag, milestone);
87+
88+CREATE INDEX milestonetag__milestones_idx
89+ ON milestonetag USING btree (milestone);
90+
91+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 0, 3);
92
93=== modified file 'database/schema/security.cfg'
94--- database/schema/security.cfg 2011-12-19 05:29:36 +0000
95+++ database/schema/security.cfg 2011-12-19 16:42:25 +0000
96@@ -223,6 +223,7 @@
97 public.messageapproval = SELECT, INSERT, UPDATE, DELETE
98 public.messagechunk = SELECT, INSERT
99 public.milestone = SELECT, INSERT, UPDATE, DELETE
100+public.milestonetag = SELECT, INSERT, UPDATE, DELETE
101 public.mirrorcdimagedistroseries = SELECT, INSERT, DELETE
102 public.mirrordistroarchseries = SELECT, INSERT, DELETE, UPDATE
103 public.mirrordistroseriessource = SELECT, INSERT, UPDATE, DELETE
104@@ -593,6 +594,7 @@
105 public.message = SELECT, INSERT
106 public.messagechunk = SELECT, INSERT
107 public.milestone = SELECT
108+public.milestonetag = SELECT
109 public.person = SELECT, INSERT, UPDATE
110 public.personlanguage = SELECT
111 public.personsettings = SELECT, INSERT
112@@ -651,6 +653,7 @@
113 public.karmaaction = SELECT
114 public.message = SELECT, INSERT
115 public.messagechunk = SELECT, INSERT
116+public.milestonetag = SELECT
117 public.person = SELECT
118 public.revision = SELECT, INSERT, UPDATE
119 public.revisionauthor = SELECT, INSERT, UPDATE
120@@ -864,6 +867,7 @@
121 public.message = SELECT, INSERT
122 public.messagechunk = SELECT, INSERT
123 public.milestone = SELECT
124+public.milestonetag = SELECT
125 public.packagecopyjob = SELECT, INSERT, DELETE
126 public.packagecopyrequest = SELECT, INSERT, UPDATE
127 public.packagediff = SELECT, INSERT, UPDATE
128@@ -1303,6 +1307,7 @@
129 public.message = SELECT, INSERT
130 public.messagechunk = SELECT, INSERT
131 public.milestone = SELECT
132+public.milestonetag = SELECT
133 public.packagebuild = SELECT, INSERT, UPDATE
134 public.packagecopyjob = SELECT, INSERT
135 public.packagediff = SELECT, INSERT, UPDATE, DELETE
136@@ -1406,6 +1411,7 @@
137 public.message = SELECT, INSERT
138 public.messagechunk = SELECT, INSERT
139 public.milestone = SELECT
140+public.milestonetag = SELECT
141 public.packagebuild = SELECT, INSERT, UPDATE
142 public.packagecopyjob = SELECT, INSERT, UPDATE
143 public.packagediff = SELECT, UPDATE
144@@ -1504,6 +1510,7 @@
145 public.message = SELECT, INSERT
146 public.messagechunk = SELECT, INSERT
147 public.milestone = SELECT
148+public.milestonetag = SELECT
149 public.person = SELECT
150 public.personlanguage = SELECT
151 public.personsettings = SELECT
152@@ -1708,6 +1715,7 @@
153 public.message = SELECT, INSERT
154 public.messagechunk = SELECT, INSERT
155 public.milestone = SELECT
156+public.milestonetag = SELECT, INSERT, DELETE
157 public.packageset = SELECT
158 public.packagesetgroup = SELECT
159 public.packagesetinclusion = SELECT
160@@ -1948,6 +1956,7 @@
161 public.job = SELECT, INSERT, UPDATE
162 public.message = SELECT, INSERT
163 public.messagechunk = SELECT, INSERT
164+public.milestonetag = SELECT
165 public.person = SELECT, INSERT
166 public.personsettings = SELECT, INSERT
167 public.product = SELECT, INSERT, UPDATE
168@@ -2046,6 +2055,7 @@
169 public.message = SELECT, UPDATE
170 public.messageapproval = SELECT, UPDATE
171 public.milestone = SELECT, UPDATE
172+public.milestonetag = SELECT, INSERT, UPDATE, DELETE
173 public.mirror = SELECT, UPDATE
174 public.nameblacklist = SELECT, UPDATE
175 public.oauthaccesstoken = SELECT, UPDATE
176@@ -2148,6 +2158,7 @@
177 public.job = SELECT, INSERT, DELETE
178 public.logintoken = SELECT, DELETE
179 public.mailinglistsubscription = SELECT, DELETE
180+public.milestonetag = SELECT
181 public.oauthnonce = SELECT, DELETE
182 public.openidconsumerassociation = SELECT, DELETE
183 public.openidconsumernonce = SELECT, DELETE

Subscribers

People subscribed via source and target branches

to status/vote changes: