Реализация на 5

This commit is contained in:
Grbisba
2026-11-13 11:05:05 +03:00
parent ec540a1a72
commit d862103650
148 changed files with 11225 additions and 55 deletions
@@ -0,0 +1,18 @@
CREATE TABLE IF NOT EXISTS messages
(
id UUID PRIMARY KEY,
chat_id UUID NOT NULL,
sender_id UUID NOT NULL,
text VARCHAR(4000) NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CONSTRAINT messages_text_not_blank CHECK (text !~ '^[[:space:]]*$'),
CONSTRAINT messages_sender_member_fk FOREIGN KEY (chat_id, sender_id)
REFERENCES chat_members (chat_id, user_id) ON DELETE NO ACTION
);
CREATE INDEX IF NOT EXISTS idx_messages_chat_id_created_at_id ON messages (chat_id, created_at, id);
---- create above / drop below ----
DROP TABLE IF EXISTS messages;