comparison database/schema/subscription.sql @ 8:68cc276ac118

SQL material from old tree, split up for accessibility.
author David A. Holland
date Sun, 19 Feb 2012 19:54:48 -0500
parents
children cd36b49f4437
comparison
equal deleted inserted replaced
7:c013fb703183 8:68cc276ac118
1 --
2 -- subscription lists
3 --
4 -- Users subscribe to PRs to be notified when the PR is modified.
5 --
6 -- If "batch" is set, notices and copies of messages are sent out
7 -- in batches.
8 --
9 -- If "reporter" is set, the user is also nagged when the PR is in
10 -- feedback. If "responsible" is set, the user is nagged when the PR
11 -- is not in feedback.
12 --
13 -- The original submitter is automatically subscribed as a reporter.
14
15 CREATE TABLE subscriptions (
16 pr bigint not null references PRs (id),
17 user bigint not null references users (id),
18 batch boolean not null,
19 reporter boolean not null,
20 responsible boolean not null
21 )
22 WITHOUT OIDS;
23
24 -- Intended constraints:
25 --
26 -- SELECT id, responsible FROM PRs, subscriptions, users
27 -- WHERE PRs.id = subscriptions.id
28 -- AND subscriptions.user = users.id
29 -- AND PRs.state <> 'closed'
30 -- AND subscriptions.responsible
31 -- AND NOT users.responsible
32 -- ;
33 --
34 -- and
35 --
36 -- SELECT id, responsible FROM PRs, subscriptions, users
37 -- WHERE PRs.id = subscriptions.id
38 -- AND subscriptions.user = users.id
39 -- AND PRs.state = 'closed'
40 -- AND subscriptions.responsible
41 -- AND NOT users.oldresponsible
42 -- ;
43 --
44 -- should always return nothing.