view database/schema/subscription.sql @ 44:812c956dd0e9

Add another admin queue type for comments on nonexistent PRs. Also, correct stupid spelling mistake. Need to get the test harness running again.
author David A. Holland
date Mon, 16 Jun 2014 01:27:45 -0400
parents cd36b49f4437
children 40f64a96481f
line wrap: on
line source

--
-- subscription lists
-- 
-- Users subscribe to PRs to be notified when the PR is modified.
--
-- If "batch" is set, notices and copies of messages are sent out
-- in batches.
--
-- If "reporter" is set, the user is also nagged when the PR is in
-- feedback. If "responsible" is set, the user is nagged when the PR
-- is not in feedback.
--
-- The original submitter is automatically subscribed as a reporter.

CREATE TABLE subscriptions (
	pr bigint		not null references PRs (id),
	userid bigint		not null references users (id),
	batch boolean		not null,
	reporter boolean	not null,
	responsible boolean	not null
)
WITHOUT OIDS;

-- Intended constraints:
--
--    SELECT id, responsible FROM PRs, subscriptions, users
--    WHERE PRs.id = subscriptions.id
--      AND subscriptions.userid = users.id
--      AND PRs.state <> 'closed'
--      AND subscriptions.responsible
--      AND NOT users.responsible
--    ;
--
-- and
--
--    SELECT id, responsible FROM PRs, subscriptions, users
--    WHERE PRs.id = subscriptions.id
--      AND subscriptions.userid = users.id
--      AND PRs.state = 'closed'
--      AND subscriptions.responsible
--      AND NOT users.oldresponsible
--    ;
--
-- should always return nothing.