← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/db-git-recipes into lp:launchpad/db-devel

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/db-git-recipes into lp:launchpad/db-devel.

Commit message:
Add SourcePackageRecipeData.base_git_repository and SourcePackageRecipeDataInstruction.git_repository columns.

Requested reviews:
  Stuart Bishop (stub): db
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1453022 in Launchpad itself: "Please support daily builds via git"
  https://bugs.launchpad.net/launchpad/+bug/1453022

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/db-git-recipes/+merge/281887

Add SourcePackageRecipeData.base_git_repository and SourcePackageRecipeDataInstruction.git_repository columns.

I believe that this is enough to support Git recipes.  We don't need reference paths in this case, because recipes already have a "revspec" which in the Git case may name a reference (or a specific commit, or ...).  This simplifies things.

I considered adding a constraint to the effect that if SourcePackageRecipeData.base_branch is not null then all the SourcePackageRecipeDataInstruction rows that refer to it must use branch rather than git_repository and vice versa, but I think that ends up being overcomplicated and doesn't buy us very much.  Let me know if you disagree.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/db-git-recipes into lp:launchpad/db-devel.
=== added file 'database/schema/patch-2209-73-0.sql'
--- database/schema/patch-2209-73-0.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-73-0.sql	2016-01-07 15:30:41 +0000
@@ -0,0 +1,24 @@
+-- Copyright 2016 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 SourcePackageRecipeData
+    ADD COLUMN base_git_repository integer REFERENCES GitRepository;
+ALTER TABLE SourcePackageRecipeData
+    ALTER COLUMN base_branch DROP NOT NULL;
+ALTER TABLE SourcePackageRecipeData
+    ADD CONSTRAINT one_base_vcs CHECK ((base_branch IS NOT NULL) != (base_git_repository IS NOT NULL));
+
+COMMENT ON COLUMN SourcePackageRecipeData.base_git_repository IS 'The Git repository the recipe is based on.';
+
+ALTER TABLE SourcePackageRecipeDataInstruction
+    ADD COLUMN git_repository integer REFERENCES GitRepository;
+ALTER TABLE SourcePackageRecipeDataInstruction
+    ALTER COLUMN branch DROP NOT NULL;
+ALTER TABLE SourcePackageRecipeDataInstruction
+    ADD CONSTRAINT one_vcs CHECK ((branch IS NOT NULL) != (git_repository IS NOT NULL));
+
+COMMENT ON COLUMN SourcePackageRecipeDataInstruction.git_repository IS 'The Git repository containing the branch being merged or nested.';
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 73, 0);