← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Commit message:
Add GitSubscription table.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers): db
  Stuart Bishop (stub): db
Related bugs:
  Bug #1444591 in Launchpad itself: "Allow Git repository subscriptions"
  https://bugs.launchpad.net/launchpad/+bug/1444591

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

Add GitSubscription table.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/db-git-subscriptions into lp:launchpad/db-devel.
=== added file 'database/schema/patch-2209-61-4.sql'
--- database/schema/patch-2209-61-4.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-61-4.sql	2015-04-15 17:19:53 +0000
@@ -0,0 +1,32 @@
+-- Copyright 2015 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+SET client_min_messages=ERROR;
+
+CREATE TABLE GitSubscription (
+    id serial PRIMARY KEY,
+    person integer NOT NULL REFERENCES person,
+    repository integer NOT NULL REFERENCES gitrepository,
+    date_created timestamp without time zone DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
+    notification_level integer DEFAULT 1 NOT NULL,
+    max_diff_lines integer,
+    review_level integer DEFAULT 0 NOT NULL,
+    subscribed_by integer NOT NULL REFERENCES person
+);
+
+CREATE INDEX gitsubscription__repository__idx
+    ON GitSubscription(repository);
+CREATE INDEX gitsubscription__subscribed_by__idx
+    ON GitSubscription(subscribed_by);
+CREATE UNIQUE INDEX gitsubscription__person__repository__key
+    ON GitSubscription(person, repository);
+
+COMMENT ON TABLE GitSubscription IS 'An association between a person or team and a Git repository.';
+COMMENT ON COLUMN GitSubscription.person IS 'The person or team associated with the repository.';
+COMMENT ON COLUMN GitSubscription.repository IS 'The repository associated with the person or team.';
+COMMENT ON COLUMN GitSubscription.notification_level IS 'The level of email the person wants to receive from repository updates.';
+COMMENT ON COLUMN GitSubscription.max_diff_lines IS 'If the generated diff for a revision is larger than this number, then the diff is not sent in the notification email.';
+COMMENT ON COLUMN GitSubscription.review_level IS 'The level of email the person wants to receive from review activity.';
+COMMENT ON COLUMN GitSubscription.subscribed_by IS 'The person who created this subscription.';
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 61, 4);

=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg	2015-03-11 23:41:40 +0000
+++ database/schema/security.cfg	2015-04-15 17:19:53 +0000
@@ -199,6 +199,7 @@
 public.gitjob                           = SELECT, INSERT, UPDATE, DELETE
 public.gitref                           = SELECT, INSERT, UPDATE, DELETE
 public.gitrepository                    = SELECT, INSERT, UPDATE, DELETE
+public.gitsubscription                  = SELECT, INSERT, UPDATE, DELETE
 public.hwdevice                         = SELECT
 public.hwdeviceclass                    = SELECT, INSERT, DELETE
 public.hwdevicedriverlink               = SELECT
@@ -691,6 +692,7 @@
 public.gitjob                             = SELECT, INSERT, UPDATE, DELETE
 public.gitref                             = SELECT, INSERT, UPDATE, DELETE
 public.gitrepository                      = SELECT, UPDATE
+public.gitsubscription                    = SELECT
 public.incrementaldiff                    = SELECT
 public.job                                = SELECT, INSERT, UPDATE, DELETE
 public.karma                              = SELECT, INSERT
@@ -1972,6 +1974,7 @@
 public.bugwatch                         = SELECT
 public.distribution                     = SELECT
 public.gitrepository                    = SELECT
+public.gitsubscription                  = SELECT, UPDATE, DELETE
 public.emailaddress                     = SELECT
 public.job                              = SELECT, INSERT, UPDATE
 public.person                           = SELECT
@@ -2007,6 +2010,9 @@
 public.distribution                     = SELECT
 public.distroseries                     = SELECT
 public.emailaddress                     = SELECT
+public.gitjob                           = SELECT
+public.gitrepository                    = SELECT
+public.gitsubscription                  = SELECT
 public.job                              = SELECT, INSERT, UPDATE
 public.karma                            = SELECT, INSERT
 public.karmaaction                      = SELECT
@@ -2156,6 +2162,7 @@
 public.faq                              = SELECT, UPDATE
 public.featureflagchangelogentry        = SELECT, UPDATE
 public.gitrepository                    = SELECT, UPDATE
+public.gitsubscription                  = SELECT, UPDATE, DELETE
 public.gpgkey                           = SELECT, UPDATE
 public.hwsubmission                     = SELECT, UPDATE
 public.ircid                            = SELECT, UPDATE


References