← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Данило Шеган has proposed merging lp:~danilo/launchpad/bug-814580-db into lp:launchpad with lp:~danilo/launchpad/bug-814580-pre-cleanup as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~danilo/launchpad/bug-814580-db/+merge/69979

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

== Proposed fix ==

Introduces a potemplate field on the PackagingJob table.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  database/schema/comments.sql
  database/schema/patch-2208-98-1.sql
-- 
https://code.launchpad.net/~danilo/launchpad/bug-814580-db/+merge/69979
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~danilo/launchpad/bug-814580-db into lp:launchpad.
=== modified file 'database/schema/comments.sql'
--- database/schema/comments.sql	2011-07-08 17:12:15 +0000
+++ database/schema/comments.sql	2011-08-01 10:37:29 +0000
@@ -1900,6 +1900,7 @@
 COMMENT ON COLUMN PackagingJob.productseries IS 'The productseries of the Packaging.';
 COMMENT ON COLUMN PackagingJob.sourcepackagename IS 'The sourcepackage of the Packaging.';
 COMMENT ON COLUMN PackagingJob.distroseries IS 'The distroseries of the Packaging.';
+COMMENT ON COLUMN PackagingJob.potemplate IS 'A POTemplate to restrict the job to or NULL if all templates need to be handled.';
 
 -- Translator / TranslationGroup
 

=== added file 'database/schema/patch-2208-98-1.sql'
--- database/schema/patch-2208-98-1.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2208-98-1.sql	2011-08-01 10:37:29 +0000
@@ -0,0 +1,24 @@
+-- Copyright 2011 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+SET client_min_messages=ERROR;
+
+ALTER TABLE PackagingJob
+  ADD COLUMN
+    potemplate INTEGER DEFAULT NULL
+      CONSTRAINT potemplate_fk REFERENCES POTemplate;
+
+ALTER TABLE PackagingJob
+  ALTER COLUMN productseries DROP NOT NULL,
+  ALTER COLUMN distroseries DROP NOT NULL,
+  ALTER COLUMN sourcepackagename DROP NOT NULL,
+  ADD CONSTRAINT translationtemplatejob_valid_link CHECK (
+    -- If there is a template, it is the template being moved.
+    (potemplate IS NOT NULL AND productseries IS NULL AND
+     distroseries IS NULL AND sourcepackagename IS NULL) OR
+    -- If there is no template, we need all of productseries, distroseries
+    -- and sourcepackagename because we are moving translations between
+    -- a productseries and a source package.
+    (potemplate IS NULL AND productseries IS NOT NULL AND
+     distroseries IS NOT NULL AND sourcepackagename IS NOT NULL));
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 98, 1);