forked from mtusi2026/mtusi2026lab4
ЛР 4 — БПИ2303 — Щербаков — на 3
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
-- This table serves only POST /api/v1/chats/{chat_id}/messages.
|
||||
-- Therefore method and canonical path are implicit in (user_id, chat_id, key).
|
||||
CREATE TABLE message_keys (
|
||||
user_id uuid NOT NULL REFERENCES users(id),
|
||||
chat_id uuid NOT NULL REFERENCES chats(id),
|
||||
key text NOT NULL CHECK (key ~ '^[A-Za-z0-9._:-]{1,128}$'),
|
||||
message_id uuid NOT NULL REFERENCES messages(id),
|
||||
expires_at timestamptz NOT NULL DEFAULT (clock_timestamp() + interval '24 hours'),
|
||||
PRIMARY KEY (user_id, chat_id, key)
|
||||
);
|
||||
CREATE INDEX message_keys_expiry ON message_keys(expires_at);
|
||||
Reference in New Issue
Block a user