Fix for #567 "mailinglist gateway does not recover after database outage".
2 Create a database at first:
3 CREATE DATABASE sonews ENCODING 'UTF8';
8 If bit 0 is set, groups is a mirrorred mailing list.
9 If not set default newsgroup.
11 Normalization: 1NF, 2NF, 3NF
16 name VARCHAR(80) NOT NULL,
17 flags SMALLINT DEFAULT 0,
19 PRIMARY KEY(group_id),
28 PRIMARY KEY(article_id)
31 CREATE TABLE article_ids
33 article_id INT REFERENCES articles(article_id) ON DELETE CASCADE,
34 message_id VARCHAR(255),
36 PRIMARY KEY(article_id),
42 article_id INT REFERENCES articles(article_id) ON DELETE CASCADE,
43 header_key VARCHAR(255),
47 PRIMARY KEY(article_id, header_key, header_index)
51 Normalization: 1NF, 2NF
56 article_id INTEGER REFERENCES articles (article_id) ON DELETE CASCADE,
57 article_index INTEGER NOT NULL,
59 PRIMARY KEY(group_id, article_id)
63 Table for association of newsgroups and mailing-lists
65 Normalization: 1NF, 2NF, 3NF
67 CREATE TABLE groups2list
69 group_id INTEGER REFERENCES groups(group_id) ON DELETE CASCADE,
70 listaddress VARCHAR(255),
72 PRIMARY KEY(group_id, listaddress)
75 CREATE INDEX listaddress_key ON groups2list USING btree(listaddress);
78 Configuration table, containing key/value pairs
80 Normalization: 1NF, 2NF, 3NF
84 config_key VARCHAR(255),
87 PRIMARY KEY(config_key)
93 Normalization: 1NF (atomic values), 2NF
101 PRIMARY KEY(peer_id),
106 List of newsgroups to feed into sonews
108 Normalization: 1NF, 2NF, 3NF
110 CREATE TABLE peer_subscriptions
112 peer_id INTEGER REFERENCES peers (peer_id) ON DELETE CASCADE,
113 group_id INTEGER REFERENCES groups (group_id) ON DELETE CASCADE,
114 feedtype SMALLINT DEFAULT 0, /* 0: pullfeed; 1: pushfeed */
116 PRIMARY KEY(peer_id, group_id, feedtype)
120 Tables for server event statistics
122 Possible statistic keys:
123 1=CONNECTIONS (active connections)
124 2=POSTED_NEWS (directly to the server posted unique messages)
125 3=GATEWAYED_NEWS (posted unique message gateways through the ML-gateway)
126 4=FEEDED_NEWS (unique messages feed via NNTP)
128 The server will create snapshots of the above data.
130 Normalization: 1NF, 2NF
134 event_time BIGINT, /* time of this snapshot */
135 event_key SMALLINT, /* which data */
136 group_id INT REFERENCES groups(group_id) ON DELETE CASCADE,
138 PRIMARY KEY(event_time, event_key)