Mercurial > libervia-pubsub
comparison db/pubsub.sql @ 87:f766e46dce0f
Initial revision
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Tue, 16 Nov 2004 10:37:01 +0000 |
parents | |
children | 4aa29b1a8c67 |
comparison
equal
deleted
inserted
replaced
86:479895007e3f | 87:f766e46dce0f |
---|---|
1 create table entities ( | |
2 id serial primary key, | |
3 jid text not null unique | |
4 ); | |
5 | |
6 create table nodes ( | |
7 id serial primary key, | |
8 node text not null unique, | |
9 persistent boolean not null default true, | |
10 deliver_payload boolean not null default true | |
11 ); | |
12 | |
13 create table affiliations ( | |
14 id serial primary key, | |
15 entity_id integer not null references entities on delete cascade, | |
16 node_id integer not null references nodes on delete cascade, | |
17 affiliation text not null | |
18 check (affiliation in ('outcast', 'publisher', 'owner')), | |
19 unique (entity_id, node_id) | |
20 ); | |
21 | |
22 create table subscriptions ( | |
23 id serial primary key, | |
24 entity_id integer not null references entities on delete cascade, | |
25 resource text, | |
26 node_id integer not null references nodes on delete cascade, | |
27 subscription text not null default 'subscribed' check | |
28 (subscription in ('subscribed', 'pending', 'unconfigured')), | |
29 unique (entity_id, resource, node_id) | |
30 ); | |
31 | |
32 create table items ( | |
33 id serial primary key, | |
34 node_id integer not null references nodes on delete cascade, | |
35 item text not null, | |
36 publisher text not null, | |
37 data text, | |
38 date timestamp with time zone not null default now(), | |
39 unique (node_id, item) | |
40 ); |