Merge lp:~danilo/launchpad/bug-814580-db into lp:launchpad

Proposed by Данило Шеган
Status: Rejected
Rejected by: Stuart Bishop
Proposed branch: lp:~danilo/launchpad/bug-814580-db
Merge into: lp:launchpad
Prerequisite: lp:~danilo/launchpad/bug-814580-pre-cleanup
Diff against target: 40 lines (+25/-0)
2 files modified
database/schema/comments.sql (+1/-0)
database/schema/patch-2208-98-1.sql (+24/-0)
To merge this branch: bzr merge lp:~danilo/launchpad/bug-814580-db
Reviewer Review Type Date Requested Status
Stuart Bishop (community) db Needs Resubmitting
Robert Collins Pending
Review via email: mp+69979@code.launchpad.net

Description of the change

= Bug 814580: do translation merging/splitting on potemplate changes (DB patch) =

== Proposed fix ==

Introduces a potemplate field on the PackagingJob table, and modifies the check constraints to ensure there is *either* potemplate defined *or* all of (productseries, distroseries, sourcepackagename).

Sample data will need to be regenerated, leaving that for after the review.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  database/schema/comments.sql
  database/schema/patch-2208-98-1.sql

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

Patch is fine, but needs a new merge proposal for db-devel

review: Needs Resubmitting (db)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'database/schema/comments.sql'
2--- database/schema/comments.sql 2011-07-08 17:12:15 +0000
3+++ database/schema/comments.sql 2011-08-01 10:37:29 +0000
4@@ -1900,6 +1900,7 @@
5 COMMENT ON COLUMN PackagingJob.productseries IS 'The productseries of the Packaging.';
6 COMMENT ON COLUMN PackagingJob.sourcepackagename IS 'The sourcepackage of the Packaging.';
7 COMMENT ON COLUMN PackagingJob.distroseries IS 'The distroseries of the Packaging.';
8+COMMENT ON COLUMN PackagingJob.potemplate IS 'A POTemplate to restrict the job to or NULL if all templates need to be handled.';
9
10 -- Translator / TranslationGroup
11
12
13=== added file 'database/schema/patch-2208-98-1.sql'
14--- database/schema/patch-2208-98-1.sql 1970-01-01 00:00:00 +0000
15+++ database/schema/patch-2208-98-1.sql 2011-08-01 10:37:29 +0000
16@@ -0,0 +1,24 @@
17+-- Copyright 2011 Canonical Ltd. This software is licensed under the
18+-- GNU Affero General Public License version 3 (see the file LICENSE).
19+SET client_min_messages=ERROR;
20+
21+ALTER TABLE PackagingJob
22+ ADD COLUMN
23+ potemplate INTEGER DEFAULT NULL
24+ CONSTRAINT potemplate_fk REFERENCES POTemplate;
25+
26+ALTER TABLE PackagingJob
27+ ALTER COLUMN productseries DROP NOT NULL,
28+ ALTER COLUMN distroseries DROP NOT NULL,
29+ ALTER COLUMN sourcepackagename DROP NOT NULL,
30+ ADD CONSTRAINT translationtemplatejob_valid_link CHECK (
31+ -- If there is a template, it is the template being moved.
32+ (potemplate IS NOT NULL AND productseries IS NULL AND
33+ distroseries IS NULL AND sourcepackagename IS NULL) OR
34+ -- If there is no template, we need all of productseries, distroseries
35+ -- and sourcepackagename because we are moving translations between
36+ -- a productseries and a source package.
37+ (potemplate IS NULL AND productseries IS NOT NULL AND
38+ distroseries IS NOT NULL AND sourcepackagename IS NOT NULL));
39+
40+INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 98, 1);