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

Proposed by Colin Watson
Status: Merged
Merged at revision: 13561
Proposed branch: lp:~cjwatson/launchpad/db-git-imports
Merge into: lp:launchpad/db-devel
Diff against target: 31 lines (+27/-0)
1 file modified
database/schema/patch-2209-80-0.sql (+27/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/db-git-imports
Reviewer Review Type Date Requested Status
William Grant db Approve
Stuart Bishop db Pending
Review via email: mp+307439@code.launchpad.net

Commit message

Add GitRepository.repository_type, CodeImport.git_repository, and CodeImportJob.secret.

Description of the change

Add GitRepository.repository_type, CodeImport.git_repository, and CodeImportJob.secret.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (db)
Revision history for this message
Colin Watson (cjwatson) wrote :

My plan was to use macaroons (in this case mainly because that's a
conveniently-packaged version of HMAC, but it would fit well with other
future plans for HTTPS pushes), effectively generating a root key for
each job. But it would probably make more sense to have a single root
key configured using the slightly-awkward secret-management arrangements
in production-configs instead, and then attach the CodeImportJob.id as a
caveat in each case. I'll put together enough code to convince myself
that this will work and delete this column if so.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'database/schema/patch-2209-80-0.sql'
2--- database/schema/patch-2209-80-0.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-80-0.sql 2016-10-04 11:56:50 +0000
4@@ -0,0 +1,27 @@
5+-- Copyright 2016 Canonical Ltd. This software is licensed under the
6+-- GNU Affero General Public License version 3 (see the file LICENSE).
7+
8+SET client_min_messages=ERROR;
9+
10+ALTER TABLE GitRepository ADD COLUMN repository_type integer;
11+
12+COMMENT ON COLUMN GitRepository.repository_type IS 'Repositories are currently one of HOSTED (1) or IMPORTED (3).';
13+
14+ALTER TABLE CodeImport
15+ ADD COLUMN git_repository integer REFERENCES gitrepository,
16+ ALTER COLUMN branch DROP NOT NULL,
17+ ADD CONSTRAINT one_target_vcs CHECK (
18+ (branch IS NOT NULL) != (git_repository IS NOT NULL)),
19+ ADD CONSTRAINT valid_source_target_vcs_pairing CHECK (
20+ branch IS NOT NULL OR rcs_type = 4),
21+ DROP CONSTRAINT codeimport_branch_key;
22+
23+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.';
24+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.';
25+
26+CREATE UNIQUE INDEX codeimport__branch__key
27+ ON CodeImport(branch) WHERE branch IS NOT NULL;
28+CREATE UNIQUE INDEX codeimport__git_repository__key
29+ ON CodeImport(git_repository) WHERE git_repository IS NOT NULL;
30+
31+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 80, 0);

Subscribers

People subscribed via source and target branches

to status/vote changes: