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

Proposed by Colin Watson on 2018-09-06
Status: Merged
Merged at revision: 13960
Proposed branch: lp:~cjwatson/launchpad/db-git-activity
Merge into: lp:launchpad/db-devel
Prerequisite: lp:~cjwatson/launchpad/db-git-permissions
Diff against target: 66 lines (+33/-0)
3 files modified
database/schema/patch-2209-85-1.sql (+29/-0)
database/schema/security.cfg (+2/-0)
lib/lp/registry/model/person.py (+2/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/db-git-activity
Reviewer Review Type Date Requested Status
William Grant db 2018-09-06 Approve on 2018-10-02
Stuart Bishop db 2018-09-06 Pending
Review via email: mp+354398@code.launchpad.net

Commit message

Add GitActivity table.

To post a comment you must log in.
13941. By Colin Watson on 2018-09-12

Merge db-git-permissions.

13942. By Colin Watson on 2018-09-13

Merge db-git-permissions.

13943. By Colin Watson on 2018-09-13

Remove deletion cascade from GitActivity.repository.

William Grant (wgrant) :
review: Approve (db)
13944. By Colin Watson on 2018-10-02

Merge db-devel.

13945. By Colin Watson on 2018-10-03

Explicitly say that GitActivity.old_value and GitActivity.new_value are JSON.

13946. By Colin Watson on 2018-10-03

Grant launchpad_main access to GitActivity; allow person-merge-job to SELECT/UPDATE GitActivity.

13947. By Colin Watson on 2018-10-03

Whitelist GitActivity FKs to Person in visibilityConsistencyWarning, since none of them expose private team membership.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'database/schema/patch-2209-85-1.sql'
2--- database/schema/patch-2209-85-1.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-85-1.sql 2018-10-03 09:15:36 +0000
4@@ -0,0 +1,29 @@
5+-- Copyright 2018 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+CREATE TABLE GitActivity (
11+ id serial PRIMARY KEY,
12+ repository integer NOT NULL REFERENCES gitrepository,
13+ date_changed timestamp without time zone DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
14+ changer integer NOT NULL REFERENCES person,
15+ changee integer REFERENCES person,
16+ what_changed integer NOT NULL,
17+ old_value text,
18+ new_value text
19+);
20+
21+CREATE INDEX gitactivity__repository__date_changed__id__idx
22+ ON GitActivity(repository, date_changed DESC, id DESC);
23+
24+COMMENT ON TABLE GitActivity IS 'An activity log entry for a Git repository.';
25+COMMENT ON COLUMN GitActivity.repository IS 'The repository that this log entry is for.';
26+COMMENT ON COLUMN GitActivity.date_changed IS 'The time when this change happened.';
27+COMMENT ON COLUMN GitActivity.changer IS 'The user who made this change.';
28+COMMENT ON COLUMN GitActivity.changee IS 'The person or team that this change was applied to.';
29+COMMENT ON COLUMN GitActivity.what_changed IS 'The property of the repository that changed.';
30+COMMENT ON COLUMN GitActivity.old_value IS 'JSON object representing the value before the change.';
31+COMMENT ON COLUMN GitActivity.new_value IS 'JSON object representing the value after the change.';
32+
33+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 85, 1);
34
35=== modified file 'database/schema/security.cfg'
36--- database/schema/security.cfg 2018-10-02 20:40:59 +0000
37+++ database/schema/security.cfg 2018-10-03 09:15:36 +0000
38@@ -187,6 +187,7 @@
39 public.featureflag = SELECT, INSERT, UPDATE, DELETE
40 public.featureflagchangelogentry = SELECT, INSERT, UPDATE
41 public.flatpackagesetinclusion = SELECT, INSERT, UPDATE, DELETE
42+public.gitactivity = SELECT, INSERT, UPDATE, DELETE
43 public.gitjob = SELECT, INSERT, UPDATE, DELETE
44 public.gitref = SELECT, INSERT, UPDATE, DELETE
45 public.gitrepository = SELECT, INSERT, UPDATE, DELETE
46@@ -2211,6 +2212,7 @@
47 public.emailaddress = SELECT, UPDATE, DELETE
48 public.faq = SELECT, UPDATE
49 public.featureflagchangelogentry = SELECT, UPDATE
50+public.gitactivity = SELECT, UPDATE
51 public.gitrepository = SELECT, UPDATE
52 public.gitrule = SELECT, UPDATE
53 public.gitrulegrant = SELECT, UPDATE, DELETE
54
55=== modified file 'lib/lp/registry/model/person.py'
56--- lib/lp/registry/model/person.py 2018-10-02 19:31:32 +0000
57+++ lib/lp/registry/model/person.py 2018-10-03 09:15:36 +0000
58@@ -2370,6 +2370,8 @@
59 ('bugtask', 'assignee'),
60 ('codereviewvote', 'reviewer'),
61 ('emailaddress', 'person'),
62+ ('gitactivity', 'changee'),
63+ ('gitactivity', 'changer'),
64 ('gitrepository', 'owner'),
65 ('gitrule', 'creator'),
66 ('gitrulegrant', 'grantee'),

Subscribers

People subscribed via source and target branches

to status/vote changes: