← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Commit message:
Add Git columns to BranchMergeProposal.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1445017 in Launchpad itself: "Support for Launchpad Git merge proposals "
  https://bugs.launchpad.net/launchpad/+bug/1445017

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

Add Git columns to BranchMergeProposal.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/db-git-mp into lp:launchpad/db-devel.
=== added file 'database/schema/patch-2209-61-5.sql'
--- database/schema/patch-2209-61-5.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-61-5.sql	2015-04-17 22:09:10 +0000
@@ -0,0 +1,32 @@
+-- Copyright 2015 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 BranchMergeProposal ADD COLUMN source_git_repository integer REFERENCES gitrepository;
+ALTER TABLE BranchMergeProposal ADD COLUMN source_git_path text;
+ALTER TABLE BranchMergeProposal ADD COLUMN source_git_commit_sha1 character(40);
+ALTER TABLE BranchMergeProposal ADD COLUMN target_git_repository integer REFERENCES gitrepository;
+ALTER TABLE BranchMergeProposal ADD COLUMN target_git_path text;
+ALTER TABLE BranchMergeProposal ADD COLUMN target_git_commit_sha1 character(40);
+ALTER TABLE BranchMergeProposal ADD COLUMN dependent_git_repository integer REFERENCES gitrepository;
+ALTER TABLE BranchMergeProposal ADD COLUMN dependent_git_path text;
+ALTER TABLE BranchMergeProposal ADD COLUMN dependent_git_commit_sha1 character(40);
+
+ALTER TABLE BranchMergeProposal
+    ADD CONSTRAINT consistent_source_git_ref CHECK ((source_git_repository IS NULL) = (source_git_path IS NULL) AND (source_git_repository IS NULL) = (source_git_commit_sha1 IS NULL));
+ALTER TABLE BranchMergeProposal
+    ADD CONSTRAINT consistent_target_git_ref CHECK ((target_git_repository IS NULL) = (target_git_path IS NULL) AND (target_git_repository IS NULL) = (target_git_commit_sha1 IS NULL));
+ALTER TABLE BranchMergeProposal
+    ADD CONSTRAINT consistent_dependent_git_ref CHECK ((dependent_git_repository IS NULL) = (dependent_git_path IS NULL) AND (dependent_git_repository IS NULL) = (dependent_git_commit_sha1 IS NULL));
+
+ALTER TABLE BranchMergeProposal
+    ADD CONSTRAINT different_git_refs CHECK (source_git_repository IS NULL OR (ROW (source_git_repository, source_git_path) != ROW (target_git_repository, target_git_path) AND ROW (dependent_git_repository, dependent_git_path) != ROW (source_git_repository, source_git_path) AND ROW (dependent_git_repository, dependent_git_path) != ROW (target_git_repository, target_git_path)));
+
+ALTER TABLE BranchMergeProposal ALTER COLUMN source_branch DROP NOT NULL;
+ALTER TABLE BranchMergeProposal ALTER COLUMN target_branch DROP NOT NULL;
+-- dependent_* may be NULL.
+ALTER TABLE BranchMergeProposal
+    ADD CONSTRAINT one_vcs CHECK ((source_branch IS NULL) != (source_git_repository IS NULL) AND (target_branch IS NULL) != (target_git_repository IS NULL) AND ((dependent_branch IS NULL) OR (dependent_git_repository IS NULL)));
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 61, 5);