← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Commit message:
Add GitRepository.repository_type, CodeImport.git_repository, and CodeImportJob.secret.

Requested reviews:
  Stuart Bishop (stub): db
  Launchpad code reviewers (launchpad-reviewers): db
Related bugs:
  Bug #1469459 in Launchpad itself: "import external code into a LP git repo (natively)"
  https://bugs.launchpad.net/launchpad/+bug/1469459

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

Add GitRepository.repository_type, CodeImport.git_repository, and CodeImportJob.secret.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/db-git-imports into lp:launchpad/db-devel.
=== added file 'database/schema/patch-2209-80-0.sql'
--- database/schema/patch-2209-80-0.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-80-0.sql	2016-10-03 14:07:42 +0000
@@ -0,0 +1,31 @@
+-- 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 GitRepository ADD COLUMN repository_type integer;
+
+COMMENT ON COLUMN GitRepository.repository_type IS 'Repositories are currently one of HOSTED (1) or IMPORTED (3).';
+
+ALTER TABLE CodeImport
+    ADD COLUMN git_repository integer REFERENCES gitrepository,
+    ALTER COLUMN branch DROP NOT NULL,
+    ADD CONSTRAINT one_target_vcs CHECK (
+        (branch IS NOT NULL) != (git_repository IS NOT NULL)),
+    ADD CONSTRAINT valid_source_target_vcs_pairing CHECK (
+        branch IS NOT NULL OR rcs_type = 4),
+    DROP CONSTRAINT codeimport_branch_key;
+
+COMMENT ON COLUMN CodeImport.branch IS 'The Bazaar branch produced by the import system, if applicable.  A placeholder branch is created when the import is created.  The import is associated with a target through the branch.';
+COMMENT ON COLUMN CodeImport.git_repository IS 'The Git repository produced by the import system, if applicable.  A placeholder repository is created when the import is created.  The import is associated with a target through the repository.';
+
+CREATE UNIQUE INDEX codeimport__branch__key
+    ON CodeImport(branch) WHERE branch IS NOT NULL;
+CREATE UNIQUE INDEX codeimport__git_repository__key
+    ON CodeImport(git_repository) WHERE git_repository IS NOT NULL;
+
+ALTER TABLE CodeImportJob ADD COLUMN secret text;
+
+COMMENT ON COLUMN CodeImportJob.secret IS 'A secret token used to communicate with the code hosting service.';
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 80, 0);