xenu_nntp/db/newsgroup.sql

42 lines
1 KiB
MySQL
Raw Normal View History

2024-11-08 15:47:21 -05:00
begin transaction;
2024-11-29 19:31:48 -05:00
create server_user (
id INTEGER PRIMARY KEY NOT NULL,
active BOOLEAN NOT NULL DEFAULT TRUE,
username TEXT NOT NULL,
password TEXT,
fullname TEXT,
mail TEXT NOT NULL
);
2024-11-08 20:31:00 -05:00
create table newsgroup (
id INTEGER PRIMARY KEY NOT NULL,
created_on DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
created_by TEXT NOT NULL,
2024-11-08 20:31:00 -05:00
name TEXT NOT NULL,
description TEXT NOT NULL
);
2024-11-08 15:47:21 -05:00
create table newsgroup_message (
2024-11-28 07:59:06 -05:00
id INTEGER PRIMARY KEY NOT NULL,
created_on DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
newsgroup_id INTEGER NOT NULL,
message_id TEXT NOT NULL UNIQUE,
reference_ids TEXT,
sender TEXT NOT NULL,
subject TEXT NOT NULL,
content TEXT NOT NULL,
2024-11-08 20:31:00 -05:00
FOREIGN KEY(newsgroup_id) REFERENCES newsgroup(id)
2024-11-08 15:47:21 -05:00
);
2024-11-25 15:52:36 -05:00
create index newsgroup_message_newsgroup_id_idx on newsgroup_message (
newsgroup_id, id
);
2024-11-25 17:16:34 -05:00
create index newsgroup_message_newsgroup_date_idx on newsgroup_message (
newsgroup_id, created_on
);
2024-11-08 15:47:21 -05:00
commit;