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),
77 Configuration table, containing key/value pairs
79 Normalization: 1NF, 2NF, 3NF
83 config_key VARCHAR(255),
86 PRIMARY KEY(config_key)
92 Normalization: 1NF (atomic values), 2NF
100 PRIMARY KEY(peer_id),
105 List of newsgroups to feed into sonews
107 Normalization: 1NF, 2NF, 3NF
109 CREATE TABLE peer_subscriptions
111 peer_id INTEGER REFERENCES peers (peer_id) ON DELETE CASCADE,
112 group_id INTEGER REFERENCES groups (group_id) ON DELETE CASCADE,
113 feedtype SMALLINT DEFAULT 0, /* 0: pullfeed; 1: pushfeed */
115 PRIMARY KEY(peer_id, group_id, feedtype)
119 Tables for server event statistics
121 Possible statistic keys:
122 1=CONNECTIONS (active connections)
123 2=POSTED_NEWS (directly to the server posted unique messages)
124 3=GATEWAYED_NEWS (posted unique message gateways through the ML-gateway)
125 4=FEEDED_NEWS (unique messages feed via NNTP)
127 The server will create snapshots of the above data.
129 Normalization: 1NF, 2NF
133 event_time BIGINT, /* time of this snapshot */
134 event_key SMALLINT, /* which data */
135 group_id INT REFERENCES groups(group_id) ON DELETE CASCADE,
137 PRIMARY KEY(event_time, event_key)