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

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: no longer in the source branch.
Merged at revision: 12953
Proposed branch: lp:~cjwatson/launchpad/db-git-more
Merge into: lp:launchpad/db-devel
Diff against target: 131 lines (+60/-6)
4 files modified
database/sampledata/current-dev.sql (+10/-3)
database/sampledata/current.sql (+10/-3)
database/schema/patch-2209-61-2.sql (+37/-0)
database/schema/security.cfg (+3/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/db-git-more
Reviewer Review Type Date Requested Status
William Grant db Approve
Launchpad code reviewers db Pending
Stuart Bishop db Pending
Review via email: mp+252672@code.launchpad.net

This proposal supersedes a proposal from 2015-03-11.

Commit message

Add GitRepository.description, flesh out GitRef, and add GitJob.

Description of the change

Here are some more Git-related database changes, mostly for the ref scanner. I fleshed out GitRef with some information about the tip commit of the ref so that we can show that in repository-level summary views in the web UI, and added a GitJob table which is enough to make the ref scanner work.

Also, GitRepository.description seems like a sensible thing to have, and doesn't seem worth splitting into a separate patch given that none of these tables contain any data outside of development systems yet.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'database/sampledata/current-dev.sql'
2--- database/sampledata/current-dev.sql 2015-01-27 17:22:08 +0000
3+++ database/sampledata/current-dev.sql 2015-03-12 11:41:01 +0000
4@@ -3857,6 +3857,16 @@
5 ALTER TABLE garbojobstate ENABLE TRIGGER ALL;
6
7
8+ALTER TABLE gitjob DISABLE TRIGGER ALL;
9+
10+
11+
12+ALTER TABLE gitjob ENABLE TRIGGER ALL;
13+
14+
15+
16+
17+
18 ALTER TABLE gitref DISABLE TRIGGER ALL;
19
20
21@@ -3870,9 +3880,6 @@
22
23
24
25-
26-
27-
28 ALTER TABLE hwvendorname DISABLE TRIGGER ALL;
29
30 INSERT INTO hwvendorname (id, name) VALUES (1, 'MSI');
31
32=== modified file 'database/sampledata/current.sql'
33--- database/sampledata/current.sql 2015-01-27 17:22:08 +0000
34+++ database/sampledata/current.sql 2015-03-12 11:41:01 +0000
35@@ -3784,6 +3784,16 @@
36 ALTER TABLE garbojobstate ENABLE TRIGGER ALL;
37
38
39+ALTER TABLE gitjob DISABLE TRIGGER ALL;
40+
41+
42+
43+ALTER TABLE gitjob ENABLE TRIGGER ALL;
44+
45+
46+
47+
48+
49 ALTER TABLE gitref DISABLE TRIGGER ALL;
50
51
52@@ -3797,9 +3807,6 @@
53
54
55
56-
57-
58-
59 ALTER TABLE hwvendorname DISABLE TRIGGER ALL;
60
61 INSERT INTO hwvendorname (id, name) VALUES (1, 'MSI');
62
63=== added file 'database/schema/patch-2209-61-2.sql'
64--- database/schema/patch-2209-61-2.sql 1970-01-01 00:00:00 +0000
65+++ database/schema/patch-2209-61-2.sql 2015-03-12 11:41:01 +0000
66@@ -0,0 +1,37 @@
67+-- Copyright 2015 Canonical Ltd. This software is licensed under the
68+-- GNU Affero General Public License version 3 (see the file LICENSE).
69+
70+SET client_min_messages=ERROR;
71+
72+ALTER TABLE GitRepository ADD COLUMN description text;
73+
74+COMMENT ON COLUMN GitRepository.description IS 'A short description of this repository.';
75+
76+ALTER TABLE GitRef ADD COLUMN object_type integer NOT NULL;
77+ALTER TABLE GitRef ADD COLUMN author integer REFERENCES revisionauthor;
78+ALTER TABLE GitRef ADD COLUMN author_date timestamp without time zone;
79+ALTER TABLE GitRef ADD COLUMN committer integer REFERENCES revisionauthor;
80+ALTER TABLE GitRef ADD COLUMN committer_date timestamp without time zone;
81+ALTER TABLE GitRef ADD COLUMN commit_message text;
82+
83+COMMENT ON COLUMN GitRef.object_type IS 'The type of object pointed to by this reference.';
84+COMMENT ON COLUMN GitRef.author IS 'The author of the commit pointed to by this reference.';
85+COMMENT ON COLUMN GitRef.author_date IS 'The author date of the commit pointed to by this reference.';
86+COMMENT ON COLUMN GitRef.committer IS 'The committer of the commit pointed to by this reference.';
87+COMMENT ON COLUMN GitRef.committer_date IS 'The committer date of the commit pointed to by this reference.';
88+COMMENT ON COLUMN GitRef.commit_message IS 'The commit message of the commit pointed to by this reference.';
89+
90+CREATE TABLE GitJob (
91+ job integer PRIMARY KEY REFERENCES job ON DELETE CASCADE UNIQUE NOT NULL,
92+ repository integer NOT NULL REFERENCES gitrepository,
93+ job_type integer NOT NULL,
94+ json_data text
95+);
96+
97+COMMENT ON TABLE GitJob IS 'Contains references to jobs that are executed for a Git repository.';
98+COMMENT ON COLUMN GitJob.job IS 'A reference to a Job row that has all the common job details.';
99+COMMENT ON COLUMN GitJob.repository IS 'The repository that this job is for.';
100+COMMENT ON COLUMN GitJob.job_type IS 'The type of job, such as a ref scan.';
101+COMMENT ON COLUMN GitJob.json_data IS 'Data that is specific to a particular job type.';
102+
103+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 61, 2);
104
105=== modified file 'database/schema/security.cfg'
106--- database/schema/security.cfg 2015-02-10 00:45:38 +0000
107+++ database/schema/security.cfg 2015-03-12 11:41:01 +0000
108@@ -196,6 +196,7 @@
109 public.featureflag = SELECT, INSERT, UPDATE, DELETE
110 public.featureflagchangelogentry = SELECT, INSERT, UPDATE
111 public.flatpackagesetinclusion = SELECT, INSERT, UPDATE, DELETE
112+public.gitjob = SELECT, INSERT, UPDATE, DELETE
113 public.gitref = SELECT, INSERT, UPDATE, DELETE
114 public.gitrepository = SELECT, INSERT, UPDATE, DELETE
115 public.hwdevice = SELECT
116@@ -687,6 +688,7 @@
117 public.distributionsourcepackage = SELECT, UPDATE
118 public.distroseries = SELECT
119 public.emailaddress = SELECT
120+public.gitjob = SELECT, INSERT, UPDATE, DELETE
121 public.gitref = SELECT, INSERT, UPDATE, DELETE
122 public.gitrepository = SELECT, UPDATE
123 public.incrementaldiff = SELECT
124@@ -2278,6 +2280,7 @@
125 public.diff = SELECT, DELETE
126 public.emailaddress = SELECT, UPDATE, DELETE
127 public.garbojobstate = SELECT, INSERT, UPDATE, DELETE
128+public.gitjob = SELECT, DELETE
129 public.hwsubmission = SELECT, UPDATE
130 public.job = SELECT, INSERT, DELETE
131 public.latestpersonsourcepackagereleasecache = SELECT, INSERT, UPDATE

Subscribers

People subscribed via source and target branches

to status/vote changes: