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

Proposed by Colin Watson
Status: Superseded
Proposed branch: lp:~cjwatson/launchpad/db-git-more
Merge into: lp:launchpad
Diff against target: 153 lines (+77/-6)
5 files modified
database/sampledata/current-dev.sql (+10/-3)
database/sampledata/current.sql (+10/-3)
database/schema/patch-2209-61-2.sql (+38/-0)
database/schema/patch-2209-62-1.sql (+16/-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
Stuart Bishop db Pending
Launchpad code reviewers db Pending
Review via email: mp+252671@code.launchpad.net

This proposal has been superseded by 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.

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-11 23:58:19 +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-11 23:58:19 +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-11 23:58:19 +0000
66@@ -0,0 +1,38 @@
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+ id serial PRIMARY KEY,
92+ job integer NOT NULL REFERENCES job,
93+ repository integer NOT NULL REFERENCES gitrepository,
94+ job_type integer NOT NULL,
95+ json_data text
96+);
97+
98+COMMENT ON TABLE GitJob IS 'Contains references to jobs that are executed for a Git repository.';
99+COMMENT ON COLUMN GitJob.job IS 'A reference to a Job row that has all the common job details.';
100+COMMENT ON COLUMN GitJob.repository IS 'The repository that this job is for.';
101+COMMENT ON COLUMN GitJob.job_type IS 'The type of job, such as a ref scan.';
102+COMMENT ON COLUMN GitJob.json_data IS 'Data that is specific to a particular job type.';
103+
104+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 61, 2);
105
106=== added file 'database/schema/patch-2209-62-1.sql'
107--- database/schema/patch-2209-62-1.sql 1970-01-01 00:00:00 +0000
108+++ database/schema/patch-2209-62-1.sql 2015-03-11 23:58:19 +0000
109@@ -0,0 +1,16 @@
110+-- Copyright 2015 Canonical Ltd. This software is licensed under the
111+-- GNU Affero General Public License version 3 (see the file LICENSE).
112+
113+SET client_min_messages=ERROR;
114+
115+ALTER TABLE translationtemplateitem
116+ ADD COLUMN msgid_singular integer REFERENCES pomsgid,
117+ ADD COLUMN msgid_plural integer REFERENCES pomsgid;
118+ALTER TABLE potemplate ADD COLUMN suggestive bool;
119+ALTER TABLE potmsgset ADD COLUMN suggestive bool;
120+ALTER TABLE translationmessage
121+ ADD COLUMN msgid_singular integer REFERENCES pomsgid,
122+ ADD COLUMN msgid_plural integer REFERENCES pomsgid,
123+ ADD COLUMN suggestive bool;
124+
125+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 62, 1);
126
127=== modified file 'database/schema/security.cfg'
128--- database/schema/security.cfg 2015-02-10 00:45:38 +0000
129+++ database/schema/security.cfg 2015-03-11 23:58:19 +0000
130@@ -196,6 +196,7 @@
131 public.featureflag = SELECT, INSERT, UPDATE, DELETE
132 public.featureflagchangelogentry = SELECT, INSERT, UPDATE
133 public.flatpackagesetinclusion = SELECT, INSERT, UPDATE, DELETE
134+public.gitjob = SELECT, INSERT, UPDATE, DELETE
135 public.gitref = SELECT, INSERT, UPDATE, DELETE
136 public.gitrepository = SELECT, INSERT, UPDATE, DELETE
137 public.hwdevice = SELECT
138@@ -687,6 +688,7 @@
139 public.distributionsourcepackage = SELECT, UPDATE
140 public.distroseries = SELECT
141 public.emailaddress = SELECT
142+public.gitjob = SELECT, INSERT, UPDATE, DELETE
143 public.gitref = SELECT, INSERT, UPDATE, DELETE
144 public.gitrepository = SELECT, UPDATE
145 public.incrementaldiff = SELECT
146@@ -2278,6 +2280,7 @@
147 public.diff = SELECT, DELETE
148 public.emailaddress = SELECT, UPDATE, DELETE
149 public.garbojobstate = SELECT, INSERT, UPDATE, DELETE
150+public.gitjob = SELECT, DELETE
151 public.hwsubmission = SELECT, UPDATE
152 public.job = SELECT, INSERT, DELETE
153 public.latestpersonsourcepackagereleasecache = SELECT, INSERT, UPDATE