ЛР 7 — БВТ2302 — Макаренко — TLS и управление секретами

This commit is contained in:
2026-12-04 13:41:59 +03:00
parent 20afc2c790
commit 8a3cf7f2dd
55 changed files with 1991 additions and 24 deletions
+7
View File
@@ -0,0 +1,7 @@
CREATE TABLE IF NOT EXISTS users(id text PRIMARY KEY, username text UNIQUE NOT NULL, password_hash text NOT NULL, doc jsonb NOT NULL);
CREATE TABLE IF NOT EXISTS sessions(digest text PRIMARY KEY, owner text REFERENCES users, expires timestamptz NOT NULL);
CREATE TABLE IF NOT EXISTS chats(id text PRIMARY KEY, doc jsonb NOT NULL);
CREATE TABLE IF NOT EXISTS members(chat text REFERENCES chats, owner text REFERENCES users, PRIMARY KEY(chat,owner));
CREATE TABLE IF NOT EXISTS messages(id text PRIMARY KEY, chat text REFERENCES chats, sender text REFERENCES users, retry_key text, doc jsonb NOT NULL, UNIQUE(chat,sender,retry_key));
CREATE INDEX IF NOT EXISTS messages_chat ON messages(chat);
CREATE TABLE IF NOT EXISTS attachments(id text PRIMARY KEY, chat text REFERENCES chats, owner text REFERENCES users, doc jsonb NOT NULL, attempts integer DEFAULT 0);