Merge lp:~mwhudson/launchpad/recipe-db-schema into lp:launchpad/db-devel
- recipe-db-schema
- Merge into db-devel
Status: | Merged |
---|---|
Approved by: | Michael Hudson-Doyle |
Approved revision: | not available |
Merged at revision: | not available |
Proposed branch: | lp:~mwhudson/launchpad/recipe-db-schema |
Merge into: | lp:launchpad/db-devel |
Diff against target: |
300 lines (+227/-0) 6 files modified
database/schema/comments.sql (+62/-0) database/schema/patch-2207-25-0.sql (+149/-0) database/schema/security.cfg (+7/-0) lib/lp/code/doc/branch.txt (+2/-0) lib/lp/code/model/branch.py (+1/-0) lib/lp/registry/model/person.py (+6/-0) |
To merge this branch: | bzr merge lp:~mwhudson/launchpad/recipe-db-schema |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stuart Bishop (community) | db | Approve | |
Jonathan Lange (community) | Approve | ||
Review via email: mp+16268@code.launchpad.net |
Commit message
The database tables for the SourcePackageRecipe build work.
Description of the change
Michael Hudson-Doyle (mwhudson) wrote : | # |
Muharem Hrnjadovic (al-maisan) wrote : | # |
Hello there!
I understood that manifests need to store the revision for each referenced branch. I don't see that detail addressed in the schema change. Or did I miss something?
Muharem Hrnjadovic (al-maisan) wrote : | # |
I read through the "First cut at recipe db-schema patch" email thread again..
Just in case you plan to keep the revision data for manifests in the SourcePackageRe
Or is there no need for such a distinction?
Michael Hudson-Doyle (mwhudson) wrote : | # |
Muharem Hrnjadovic wrote:
> I read through the "First cut at recipe db-schema patch" email thread again..
>
> Just in case you plan to keep the revision data for manifests in the SourcePackageRe
I guess I was expecting that you wouldn't do a big query for all
SourcePackageRe
into recipe and manifest links but rather do two queries, one for
recipes referencing a branch and then one for manifests/build logs
referencing a branch. In my model code currently, there is no interface
for SourcePackageRe
SourcePackageRecipe content type.
> Or is there no need for such a distinction?
I don't really think there is.
Cheers,
mwh
Michael Hudson-Doyle (mwhudson) wrote : | # |
Muharem Hrnjadovic wrote:
> Hello there!
>
> I understood that manifests need to store the revision for each referenced branch. I don't see that detail addressed in the schema change. Or did I miss something?
Oh whoops, forgot about that.
I think I'm gradually coming around to Jono's view that we'll have
fairly structured storage of the recipe in the db, so all this will
probably change quite a bit before we start using it in anger.
Cheers,
mwh
Stuart Bishop (stub) wrote : | # |
I'm curious why SourcePackageRe
If this is a 1:1 relationship, do you have a rationale for this being a separate table?
If this is not a 1:1 relationship, how do we express this in English? A SourcePackageRecipe contains multiple recipes?
I'm happy to have the non-structured recipe column provided we don't need to do anything with it besides store it, retrieve it, and send it to builders. If the appservers need to decode it we should consider a more structured format per Jono's reported views.
SourcePackageBu
The SourcePackageRecipe unique index does not match its name. Do you want (owner, distroseries, sourcepackagename, name) unique or just (distroseries, sourcepackagename, name)? I prefer ALTER TABLE ADD CONSTRAINT sourcepackagere
It is going to need more indexes - pretty much every foreign key constraint needs an index on that column. I can add these in later if you want. We also will probably need indexes on SourcePackageBuild and SourcePackageBu
Jonathan Lange (jml) wrote : | # |
Michael and I had a chat on the phone. We've worked out a schema that will have a much more structured view of recipes. Should be up for review again tomorrow.
Michael Hudson-Doyle (mwhudson) wrote : | # |
Hi guys, I think the patch is now ready and we'd like to land it before It will still need indexes added, but I hope stub can do that :-)
Jonathan Lange (jml) wrote : | # |
* 'name' on SPRInstruction should be NOT NULL, I think.
* You _could_ add a constraint saying that the line number should be strictly greater than the parent's line number. Not sure if this is necessary.
* Shouldn't SourcePackageBu
Other than that, looks good.
Michael Hudson-Doyle (mwhudson) wrote : | # |
* OK.
* Doesn't seem useful really
* OK.
Go again?
Stuart Bishop (stub) wrote : | # |
Allocated patch number is patch-2207-25-0.sql
SourcePackageRe
The sourcepackagere
sourcepackagere
Please change:
ALTER TABLE SourcePackageRe
ADD CONSTRAINT sourcepackagere
UNIQUE (line_number, recipe_data);
into the more useful to PostgreSQL variant:
ALTER TABLE SourcePackageRe
sourcepackagere
UNIQUE (recipe_data, line_number);
sourcepackage is one word in Launchpad, so the .*source_package.* columns
need to be renamed .*sourcepackage.*.
As discussed on IRC and seen at http://
Needed indexes:
CREATE INDEX sourcepackagere
ON SourcepackageRe
CREATE INDEX sourcepackagere
ON SourcepackageRe
CREATE INDEX sourcepackagere
ON SourcepackageRe
--CREATE INDEX sourcepackagere
--ON SourcepackageRe
CREATE INDEX sourcepackagere
ON SourcepackageRe
CREATE INDEX sourcepackagere
ON SourcepackageRe
CREATE INDEX sourcepackagere
ON SourcepackageRe
CREATE INDEX sourcepackagere
ON SourcepackageRe
CREATE INDEX sourcepackagere
ON SourcepackageRe
CREATE INDEX sourcepackagere
ON SourcepackageRe
CREATE INDEX sourcepackagebu
ON SourcepackageRe
Stuart Bishop (stub) wrote : | # |
I missed some indexes and one of the constraints is wrong.
CREATE INDEX sourcepackagere
ON SourcepackageRe
CREATE INDEX sourcepackagere
ON SourcepackageRe
CREATE INDEX sourcepackagere
ON SourcepackageRe
Should BuildSourcepack
ALTER TABLE BuildSourcepack
buildsourcepack
Otherwise:
CREATE INDEX buildsourcepack
ON BuildSourcepack
One of the constraints is wrong (NULL != NULL in SQL 3-value boolean). Drop:
ALTER TABLE SourcePackageRe
sourcepackagere
UNIQUE (sourcepackage_
Replace with:
CREATE UNIQUE UNDEX sourcepackagere
ON SourcepackageRe
WHERE sourcepackage_
CREATE UNIQUE INDEX sourcepackagere
ON SourcepackageRe
WHERE sourcepackage_
Preview Diff
1 | === modified file 'database/schema/comments.sql' | |||
2 | --- database/schema/comments.sql 2010-01-11 04:46:04 +0000 | |||
3 | +++ database/schema/comments.sql 2010-01-13 05:13:16 +0000 | |||
4 | @@ -1288,7 +1288,69 @@ | |||
5 | 1288 | 1288 | ||
6 | 1289 | COMMENT ON TABLE SourcePackageName IS 'SourcePackageName: A soyuz source package name.'; | 1289 | COMMENT ON TABLE SourcePackageName IS 'SourcePackageName: A soyuz source package name.'; |
7 | 1290 | 1290 | ||
8 | 1291 | -- SourcePackageRecipeData | ||
9 | 1292 | |||
10 | 1293 | COMMENT ON TABLE SourcePackageRecipeData IS 'The database representation of a BaseRecipeBranch from bzr-builder. Exactly one of sourcepackage_recipe or sourcepackage_recipe_build will be non-NULL.'; | ||
11 | 1294 | COMMENT ON COLUMN SourcePackageRecipeData.base_branch IS 'The branch the recipe is based on.'; | ||
12 | 1295 | COMMENT ON COLUMN SourcePackageRecipeData.recipe_format IS 'The format version of the recipe.'; | ||
13 | 1296 | COMMENT ON COLUMN SourcePackageRecipeData.deb_version_template IS 'The template for the revision number of the build.'; | ||
14 | 1297 | COMMENT ON COLUMN SourcePackageRecipeData.revspec IS 'The revision from base_branch to use.'; | ||
15 | 1298 | COMMENT ON COLUMN SourcePackageRecipeData.sourcepackage_recipe IS 'The recipe that this data is for.'; | ||
16 | 1299 | COMMENT ON COLUMN SourcePackageRecipeData.sourcepackage_recipe_build IS 'The build that resulted in this manifest.'; | ||
17 | 1300 | |||
18 | 1301 | -- SourcePackageRecipeDataInstruction | ||
19 | 1302 | |||
20 | 1303 | COMMENT ON TABLE SourcePackageRecipeDataInstruction IS 'A line from the recipe, specifying a branch to nest or merge.'; | ||
21 | 1304 | COMMENT ON COLUMN SourcePackageRecipeDataInstruction.name IS 'The name of the instruction.'; | ||
22 | 1305 | COMMENT ON COLUMN SourcePackageRecipeDataInstruction.type IS 'The type of the instruction (MERGE == 1, NEST == 2).'; | ||
23 | 1306 | COMMENT ON COLUMN SourcePackageRecipeDataInstruction.comment IS 'The comment from the recipe about this instruction.'; | ||
24 | 1307 | COMMENT ON COLUMN SourcePackageRecipeDataInstruction.line_number IS 'The line number of the instruction in the recipe.'; | ||
25 | 1308 | COMMENT ON COLUMN SourcePackageRecipeDataInstruction.branch IS 'The branch being merged or nested.'; | ||
26 | 1309 | COMMENT ON COLUMN SourcePackageRecipeDataInstruction.revspec IS 'The revision of the branch to use.'; | ||
27 | 1310 | COMMENT ON COLUMN SourcePackageRecipeDataInstruction.directory IS 'The location to nest at, if this is a nest instruction.'; | ||
28 | 1311 | COMMENT ON COLUMN SourcePackageRecipeDataInstruction.recipe_data IS 'The SourcePackageRecipeData this instruction is part of.'; | ||
29 | 1312 | COMMENT ON COLUMN SourcePackageRecipeDataInstruction.parent_instruction IS 'The nested branch this instruction applies to, or NULL for a top-level instruction.'; | ||
30 | 1313 | |||
31 | 1314 | -- SourcePackageRecipe | ||
32 | 1315 | |||
33 | 1316 | COMMENT ON TABLE SourcePackageRecipe IS 'A recipe for assembling a source package from branches.'; | ||
34 | 1317 | COMMENT ON COLUMN SourcePackageRecipe.registrant IS 'The person who created this recipe.'; | ||
35 | 1318 | COMMENT ON COLUMN SourcePackageRecipe.owner IS 'The person or team who can edit this recipe.'; | ||
36 | 1319 | COMMENT ON COLUMN SourcePackageRecipe.distroseries IS 'The distroseries this recipe builds a package for.'; | ||
37 | 1320 | COMMENT ON COLUMN SourcePackageRecipe.sourcepackagename IS 'The name of the source package this recipe builds.'; | ||
38 | 1321 | COMMENT ON COLUMN SourcePackageRecipe.name IS 'The name of the recipe in the web/URL.'; | ||
39 | 1322 | |||
40 | 1323 | -- SourcePackageRecipeBuild | ||
41 | 1324 | |||
42 | 1325 | COMMENT ON TABLE SourcePackageRecipeBuild IS 'The build record for the process of building a source package as described by a recipe.'; | ||
43 | 1326 | COMMENT ON COLUMN SourcePackageRecipeBuild.distroseries IS 'The distroseries the build was for.'; | ||
44 | 1327 | COMMENT ON COLUMN SourcePackageRecipeBuild.sourcepackagename IS 'The name of the source package that was built.'; | ||
45 | 1328 | COMMENT ON COLUMN SourcePackageRecipeBuild.build_state IS 'The state of the build.'; | ||
46 | 1329 | COMMENT ON COLUMN SourcePackageRecipeBuild.date_built IS 'When the build record was processed.'; | ||
47 | 1330 | COMMENT ON COLUMN SourcePackageRecipeBuild.build_duration IS 'How long this build took to be processed.'; | ||
48 | 1331 | COMMENT ON COLUMN SourcePackageRecipeBuild.build_log IS 'Points to the build_log file stored in librarian.'; | ||
49 | 1332 | COMMENT ON COLUMN SourcePackageRecipeBuild.builder IS 'Points to the builder which has once processed it.'; | ||
50 | 1333 | COMMENT ON COLUMN SourcePackageRecipeBuild.date_first_dispatched IS 'The instant the build was dispatched the first time. This value will not get overridden if the build is retried.'; | ||
51 | 1334 | COMMENT ON COLUMN SourcePackageRecipeBuild.requester IS 'Who requested the build.'; | ||
52 | 1335 | COMMENT ON COLUMN SourcePackageRecipeBuild.recipe IS 'The recipe being processed.'; | ||
53 | 1336 | COMMENT ON COLUMN SourcePackageRecipeBuild.archive IS 'The archive the source package will be uploaded to.'; | ||
54 | 1337 | |||
55 | 1338 | -- SourcePackageRecipeBuildUpload | ||
56 | 1339 | |||
57 | 1340 | COMMENT ON TABLE SourcePackageRecipeBuildUpload IS 'The record of uploading the source package built by a SourcePackageRecipeBuild to an archive.'; | ||
58 | 1341 | COMMENT ON COLUMN SourcePackageRecipeBuildUpload.registrant IS 'Who requested the upload.'; | ||
59 | 1342 | COMMENT ON COLUMN SourcePackageRecipeBuildUpload.sourcepackage_recipe_build IS 'Upload the output of this build.'; | ||
60 | 1343 | COMMENT ON COLUMN SourcePackageRecipeBuildUpload.archive IS 'The archive to upload to.'; | ||
61 | 1344 | COMMENT ON COLUMN SourcePackageRecipeBuildUpload.upload_log IS 'The output from uploading the source package to the archive.'; | ||
62 | 1345 | COMMENT ON COLUMN SourcePackageRecipeBuildUpload.state IS 'The state of the upload.'; | ||
63 | 1346 | |||
64 | 1347 | -- SourcePackageRecipeBuildJob | ||
65 | 1348 | |||
66 | 1349 | COMMENT ON TABLE SourcePackageRecipeBuildJob IS 'The link between a SourcePackageRecipeBuild row and a Job row to schedule a build of a source package recipe.'; | ||
67 | 1350 | COMMENT ON COLUMN SourcePackageRecipeBuildJob.sourcepackage_recipe_build IS 'The build record describing the package being built.'; | ||
68 | 1351 | |||
69 | 1291 | -- Specification | 1352 | -- Specification |
70 | 1353 | |||
71 | 1292 | COMMENT ON TABLE Specification IS 'A feature specification. At the moment we do not store the actual specification, we store a URL for the spec, which is managed in a wiki somewhere else. We store the overall state of the spec, as well as queueing information about who needs to review the spec, and why.'; | 1354 | COMMENT ON TABLE Specification IS 'A feature specification. At the moment we do not store the actual specification, we store a URL for the spec, which is managed in a wiki somewhere else. We store the overall state of the spec, as well as queueing information about who needs to review the spec, and why.'; |
72 | 1293 | COMMENT ON COLUMN Specification.assignee IS 'The person who has been assigned to implement this specification.'; | 1355 | COMMENT ON COLUMN Specification.assignee IS 'The person who has been assigned to implement this specification.'; |
73 | 1294 | COMMENT ON COLUMN Specification.drafter IS 'The person who has been asked to draft this specification. They are responsible for getting the spec to "approved" state.'; | 1356 | COMMENT ON COLUMN Specification.drafter IS 'The person who has been asked to draft this specification. They are responsible for getting the spec to "approved" state.'; |
74 | 1295 | 1357 | ||
75 | === added file 'database/schema/patch-2207-25-0.sql' | |||
76 | --- database/schema/patch-2207-25-0.sql 1970-01-01 00:00:00 +0000 | |||
77 | +++ database/schema/patch-2207-25-0.sql 2010-01-13 05:13:16 +0000 | |||
78 | @@ -0,0 +1,149 @@ | |||
79 | 1 | SET client_min_messages=ERROR; | ||
80 | 2 | |||
81 | 3 | CREATE TABLE SourcePackageRecipe ( | ||
82 | 4 | id serial PRIMARY KEY, | ||
83 | 5 | date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL, | ||
84 | 6 | date_last_modified timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL, | ||
85 | 7 | registrant integer NOT NULL REFERENCES Person, | ||
86 | 8 | owner integer NOT NULL REFERENCES Person, | ||
87 | 9 | distroseries integer NOT NULL REFERENCES DistroSeries, | ||
88 | 10 | sourcepackagename integer NOT NULL REFERENCES SourcePackageName, | ||
89 | 11 | name text NOT NULL | ||
90 | 12 | ); | ||
91 | 13 | |||
92 | 14 | ALTER TABLE SourcePackageRecipe ADD CONSTRAINT sourcepackagerecipe__owner__distroseries__sourcepackagename__name__key | ||
93 | 15 | UNIQUE (owner, distroseries, sourcepackagename, name); | ||
94 | 16 | |||
95 | 17 | CREATE TABLE SourcePackageRecipeBuild ( | ||
96 | 18 | id serial PRIMARY KEY, | ||
97 | 19 | -- most of this is just copied from Build | ||
98 | 20 | |||
99 | 21 | -- I've dropped: processor, sourcepackagerelease, pocket, dependencies | ||
100 | 22 | -- changed: distroarchseries to distroseries | ||
101 | 23 | -- added: recipe and manifest | ||
102 | 24 | date_created timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL, | ||
103 | 25 | distroseries integer NOT NULL REFERENCES distroseries, | ||
104 | 26 | sourcepackagename integer NOT NULL REFERENCES SourcePackageName, | ||
105 | 27 | build_state integer NOT NULL, | ||
106 | 28 | date_built timestamp without time zone, | ||
107 | 29 | build_duration interval, | ||
108 | 30 | build_log integer REFERENCES libraryfilealias, | ||
109 | 31 | builder integer REFERENCES builder, | ||
110 | 32 | date_first_dispatched timestamp without time zone, | ||
111 | 33 | requester integer NOT NULL REFERENCES Person, | ||
112 | 34 | recipe integer REFERENCES SourcePackageRecipe NOT NULL, | ||
113 | 35 | archive integer NOT NULL REFERENCES Archive | ||
114 | 36 | ); | ||
115 | 37 | |||
116 | 38 | CREATE TABLE SourcePackageRecipeBuildUpload ( | ||
117 | 39 | id serial PRIMARY KEY, | ||
118 | 40 | date_created timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL, | ||
119 | 41 | registrant integer NOT NULL REFERENCES Person, | ||
120 | 42 | sourcepackage_recipe_build integer NOT NULL REFERENCES SourcePackageRecipeBuild, | ||
121 | 43 | archive integer NOT NULL REFERENCES Archive, | ||
122 | 44 | upload_log integer REFERENCES LibraryFileAlias, | ||
123 | 45 | state integer NOT NULL -- an enum, WAITING/UPLOADED/FAILED or something like that. | ||
124 | 46 | ); | ||
125 | 47 | |||
126 | 48 | -- indexes for SourcePackageRecipeBuildUpload I guess | ||
127 | 49 | |||
128 | 50 | ALTER TABLE SourcePackageRelease | ||
129 | 51 | ADD COLUMN sourcepackage_recipe_build integer REFERENCES SourcePackageRecipeBuild; | ||
130 | 52 | |||
131 | 53 | CREATE TABLE SourcePackageRecipeBuildJob ( | ||
132 | 54 | id serial PRIMARY KEY, | ||
133 | 55 | job integer NOT NULL REFERENCES Job, | ||
134 | 56 | sourcepackage_recipe_build integer REFERENCES SourcePackageRecipeBuild | ||
135 | 57 | ); | ||
136 | 58 | |||
137 | 59 | ALTER TABLE SourcePackageRecipeBuildJob ADD CONSTRAINT sourcepackagerecipebuildjob__sourcepackage_recipe_build__key | ||
138 | 60 | UNIQUE (sourcepackage_recipe_build); | ||
139 | 61 | |||
140 | 62 | ALTER TABLE SourcePackageRecipeBuildJob ADD CONSTRAINT sourcepackagerecipebuildjob__job__key | ||
141 | 63 | UNIQUE (job); | ||
142 | 64 | |||
143 | 65 | CREATE TABLE SourcePackageRecipeData ( | ||
144 | 66 | id serial PRIMARY KEY, | ||
145 | 67 | base_branch integer NOT NULL REFERENCES Branch, | ||
146 | 68 | recipe_format text NOT NULL, | ||
147 | 69 | deb_version_template text NOT NULL, | ||
148 | 70 | revspec text, | ||
149 | 71 | sourcepackage_recipe integer REFERENCES SourcePackageRecipe, | ||
150 | 72 | sourcepackage_recipe_build integer REFERENCES SourcePackageRecipeBuild | ||
151 | 73 | ); | ||
152 | 74 | |||
153 | 75 | ALTER TABLE SourcePackageRecipeData ADD CONSTRAINT sourcepackagerecipedata__recipe_or_build_is_not_null | ||
154 | 76 | CHECK (sourcepackage_recipe IS NULL != sourcepackage_recipe_build IS NULL); | ||
155 | 77 | CREATE UNIQUE INDEX sourcepackagerecipedata__sourcepackage_recipe__key | ||
156 | 78 | ON SourcepackageRecipeData(sourcepackage_recipe) | ||
157 | 79 | WHERE sourcepackage_recipe IS NOT NULL; | ||
158 | 80 | CREATE UNIQUE INDEX sourcepackagerecipedata__sourcepackage_recipe_build__key | ||
159 | 81 | ON SourcepackageRecipeData(sourcepackage_recipe_build) | ||
160 | 82 | WHERE sourcepackage_recipe_build IS NOT NULL; | ||
161 | 83 | |||
162 | 84 | CREATE TABLE SourcePackageRecipeDataInstruction ( | ||
163 | 85 | id serial PRIMARY KEY, | ||
164 | 86 | name text NOT NULL, | ||
165 | 87 | type integer NOT NULL, -- MERGE == 1, NEST == 2 | ||
166 | 88 | comment text, | ||
167 | 89 | line_number integer NOT NULL, | ||
168 | 90 | branch integer NOT NULL REFERENCES Branch, | ||
169 | 91 | revspec text, | ||
170 | 92 | directory text, | ||
171 | 93 | recipe_data integer NOT NULL REFERENCES SourcePackageRecipeData, | ||
172 | 94 | parent_instruction integer REFERENCES SourcePackageRecipeDataInstruction | ||
173 | 95 | ); | ||
174 | 96 | |||
175 | 97 | ALTER TABLE SourcePackageRecipeDataInstruction ADD CONSTRAINT sourcepackagerecipedatainstruction__name__recipe_data__key | ||
176 | 98 | UNIQUE (name, recipe_data); | ||
177 | 99 | ALTER TABLE SourcePackageRecipeDataInstruction ADD CONSTRAINT sourcepackagerecipedatainstruction__recipe_data__line_number__key | ||
178 | 100 | UNIQUE (recipe_data, line_number); | ||
179 | 101 | ALTER TABLE SourcePackageRecipeDataInstruction ADD CONSTRAINT sourcepackagerecipedatainstruction__directory_not_null | ||
180 | 102 | CHECK ((type = 1 AND directory IS NULL) OR (type = 2 AND directory IS NOT NULL)); | ||
181 | 103 | |||
182 | 104 | CREATE INDEX sourcepackagerecipedata__base_branch__idx | ||
183 | 105 | ON SourcepackageRecipeData(base_branch); | ||
184 | 106 | |||
185 | 107 | CREATE INDEX sourcepackagerecipedatainstruction__branch__idx | ||
186 | 108 | ON SourcepackageRecipeDataInstruction(branch); | ||
187 | 109 | |||
188 | 110 | CREATE INDEX sourcepackagerecipe__registrant__idx | ||
189 | 111 | ON SourcepackageRecipe(registrant); | ||
190 | 112 | |||
191 | 113 | --CREATE INDEX sourcepackagerecipe__owner__idx | ||
192 | 114 | --ON SourcepackageRecipe(owner); | ||
193 | 115 | |||
194 | 116 | CREATE INDEX sourcepackagerecipebuild__distroseries__idx | ||
195 | 117 | ON SourcepackageRecipeBuild(distroseries); | ||
196 | 118 | |||
197 | 119 | CREATE INDEX sourcepackagerecipebuild__sourcepackagename__idx | ||
198 | 120 | ON SourcepackageRecipeBuild(sourcepackagename); | ||
199 | 121 | |||
200 | 122 | CREATE INDEX sourcepackagerecipebuild__build_log__idx | ||
201 | 123 | ON SourcepackageRecipeBuild(build_log) WHERE build_log IS NOT NULL; | ||
202 | 124 | |||
203 | 125 | CREATE INDEX sourcepackagerecipebuild__builder__idx | ||
204 | 126 | ON SourcepackageRecipeBuild(builder); | ||
205 | 127 | |||
206 | 128 | CREATE INDEX sourcepackagerecipebuild__requester__idx | ||
207 | 129 | ON SourcepackageRecipeBuild(requester); | ||
208 | 130 | |||
209 | 131 | CREATE INDEX sourcepackagerecipebuild__recipe__idx | ||
210 | 132 | ON SourcepackageRecipeBuild(recipe); | ||
211 | 133 | |||
212 | 134 | CREATE INDEX sourcepackagerecipebuild__archive__idx | ||
213 | 135 | ON SourcepackageRecipeBuild(archive); | ||
214 | 136 | |||
215 | 137 | CREATE INDEX sourcepackagebuildupload__registrant__idx | ||
216 | 138 | ON SourcepackageRecipeBuildUpload(registrant); | ||
217 | 139 | |||
218 | 140 | CREATE INDEX sourcepackagerecipebuildupload__archive__idx | ||
219 | 141 | ON SourcepackageRecipeBuildUpload(archive); | ||
220 | 142 | |||
221 | 143 | CREATE INDEX sourcepackagerecipebuildupload__upload_log__idx | ||
222 | 144 | ON SourcepackageRecipeBuildUpload(upload_log) WHERE upload_log IS NOT NULL; | ||
223 | 145 | |||
224 | 146 | CREATE INDEX sourcepackagerelease__sourcepackage_recipe_build__idx | ||
225 | 147 | ON SourcepackageRelease(sourcepackage_recipe_build); | ||
226 | 148 | |||
227 | 149 | INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 25, 0); | ||
228 | 0 | 150 | ||
229 | === modified file 'database/schema/security.cfg' | |||
230 | --- database/schema/security.cfg 2010-01-06 14:25:01 +0000 | |||
231 | +++ database/schema/security.cfg 2010-01-13 05:13:16 +0000 | |||
232 | @@ -275,6 +275,11 @@ | |||
233 | 275 | public.sourcepackagepublishinghistory = SELECT | 275 | public.sourcepackagepublishinghistory = SELECT |
234 | 276 | public.seriessourcepackagebranch = SELECT, INSERT, UPDATE, DELETE | 276 | public.seriessourcepackagebranch = SELECT, INSERT, UPDATE, DELETE |
235 | 277 | public.sourcepackageformatselection = SELECT | 277 | public.sourcepackageformatselection = SELECT |
236 | 278 | public.sourcepackagerecipe = SELECT, INSERT, UPDATE, DELETE | ||
237 | 279 | public.sourcepackagerecipebuild = SELECT, INSERT, UPDATE, DELETE | ||
238 | 280 | public.sourcepackagerecipebuildupload = SELECT, INSERT, UPDATE, DELETE | ||
239 | 281 | public.sourcepackagerecipedata = SELECT, INSERT, UPDATE, DELETE | ||
240 | 282 | public.sourcepackagerecipedatainstruction = SELECT, INSERT, UPDATE, DELETE | ||
241 | 278 | public.specificationbranch = SELECT, INSERT, UPDATE, DELETE | 283 | public.specificationbranch = SELECT, INSERT, UPDATE, DELETE |
242 | 279 | public.specificationbug = SELECT, INSERT, DELETE | 284 | public.specificationbug = SELECT, INSERT, DELETE |
243 | 280 | public.specificationdependency = SELECT, INSERT, DELETE | 285 | public.specificationdependency = SELECT, INSERT, DELETE |
244 | @@ -403,6 +408,8 @@ | |||
245 | 403 | public.shippingrun = SELECT | 408 | public.shippingrun = SELECT |
246 | 404 | public.sprint = SELECT | 409 | public.sprint = SELECT |
247 | 405 | public.sourcepackagereleasefile = SELECT | 410 | public.sourcepackagereleasefile = SELECT |
248 | 411 | public.sourcepackagerecipebuild = SELECT | ||
249 | 412 | public.sourcepackagerecipebuildupload = SELECT | ||
250 | 406 | public.temporaryblobstorage = SELECT, DELETE | 413 | public.temporaryblobstorage = SELECT, DELETE |
251 | 407 | public.translationimportqueueentry = SELECT | 414 | public.translationimportqueueentry = SELECT |
252 | 408 | 415 | ||
253 | 409 | 416 | ||
254 | === modified file 'lib/lp/code/doc/branch.txt' | |||
255 | --- lib/lp/code/doc/branch.txt 2009-12-10 04:38:46 +0000 | |||
256 | +++ lib/lp/code/doc/branch.txt 2010-01-13 05:13:16 +0000 | |||
257 | @@ -601,6 +601,8 @@ | |||
258 | 601 | productseries.branch | 601 | productseries.branch |
259 | 602 | productseries.translations_branch | 602 | productseries.translations_branch |
260 | 603 | seriessourcepackagebranch.branch | 603 | seriessourcepackagebranch.branch |
261 | 604 | sourcepackagerecipedata.base_branch | ||
262 | 605 | sourcepackagerecipedatainstruction.branch | ||
263 | 604 | specificationbranch.branch | 606 | specificationbranch.branch |
264 | 605 | 607 | ||
265 | 606 | (Unfortunately, references can form a cycle-- note that codereviewcomments | 608 | (Unfortunately, references can form a cycle-- note that codereviewcomments |
266 | 607 | 609 | ||
267 | === modified file 'lib/lp/code/model/branch.py' | |||
268 | --- lib/lp/code/model/branch.py 2009-12-11 00:56:16 +0000 | |||
269 | +++ lib/lp/code/model/branch.py 2010-01-13 05:13:16 +0000 | |||
270 | @@ -613,6 +613,7 @@ | |||
271 | 613 | series_set = getUtility(IFindOfficialBranchLinks) | 613 | series_set = getUtility(IFindOfficialBranchLinks) |
272 | 614 | alteration_operations.extend( | 614 | alteration_operations.extend( |
273 | 615 | map(ClearOfficialPackageBranch, series_set.findForBranch(self))) | 615 | map(ClearOfficialPackageBranch, series_set.findForBranch(self))) |
274 | 616 | # XXX MichaelHudson 2010-01-13: Handle sourcepackagerecipes here. | ||
275 | 616 | return (alteration_operations, deletion_operations) | 617 | return (alteration_operations, deletion_operations) |
276 | 617 | 618 | ||
277 | 618 | def deletionRequirements(self): | 619 | def deletionRequirements(self): |
278 | 619 | 620 | ||
279 | === modified file 'lib/lp/registry/model/person.py' | |||
280 | --- lib/lp/registry/model/person.py 2010-01-07 06:27:46 +0000 | |||
281 | +++ lib/lp/registry/model/person.py 2010-01-13 05:13:16 +0000 | |||
282 | @@ -2838,6 +2838,8 @@ | |||
283 | 2838 | (decorator_table.lower(), person_pointer_column.lower())) | 2838 | (decorator_table.lower(), person_pointer_column.lower())) |
284 | 2839 | 2839 | ||
285 | 2840 | def _mergeBranches(self, cur, from_id, to_id): | 2840 | def _mergeBranches(self, cur, from_id, to_id): |
286 | 2841 | # XXX MichaelHudson 2010-01-13 bug=506630: This code does not account | ||
287 | 2842 | # for package branches. | ||
288 | 2841 | cur.execute(''' | 2843 | cur.execute(''' |
289 | 2842 | SELECT product, name FROM Branch WHERE owner = %(to_id)d | 2844 | SELECT product, name FROM Branch WHERE owner = %(to_id)d |
290 | 2843 | ''' % vars()) | 2845 | ''' % vars()) |
291 | @@ -3348,6 +3350,10 @@ | |||
292 | 3348 | self._mergeBranches(cur, from_id, to_id) | 3350 | self._mergeBranches(cur, from_id, to_id) |
293 | 3349 | skip.append(('branch','owner')) | 3351 | skip.append(('branch','owner')) |
294 | 3350 | 3352 | ||
295 | 3353 | # XXX MichaelHudson 2010-01-13: Write _mergeSourcePackageRecipes! | ||
296 | 3354 | #self._mergeSourcePackageRecipes(cur, from_id, to_id)) | ||
297 | 3355 | skip.append(('sourcepackagerecipe','owner')) | ||
298 | 3356 | |||
299 | 3351 | self._mergeMailingListSubscriptions(cur, from_id, to_id) | 3357 | self._mergeMailingListSubscriptions(cur, from_id, to_id) |
300 | 3352 | skip.append(('mailinglistsubscription', 'person')) | 3358 | skip.append(('mailinglistsubscription', 'person')) |
301 | 3353 | 3359 |
Hi there,
This branch adds the db schema for sourcepackagere cipes and associated things that was much discussed on the list. I've written a little code using this schema now (see lp:~mwhudson/launchpad/recipe-model-code) and it still feels more or less right and I would like to start landing code, so now seems like a good time to get this branch formally reviewed.
This presupposes a fairly boring way of representing recipes in the database -- but I think that this will be easier to change if we want to later.
Cheers,
mwh