ЛР 7: реализация мессенджера и сценарии проверки

This commit is contained in:
Russiankryt
2026-12-03 17:20:53 +03:00
parent 20afc2c790
commit 3dd0587e7d
57 changed files with 3470 additions and 55 deletions
+17
View File
@@ -0,0 +1,17 @@
CREATE TABLE attachments (
id uuid PRIMARY KEY,
chat_id uuid NOT NULL REFERENCES chats(id),
owner_id uuid NOT NULL,
filename text NOT NULL,
content_type text NOT NULL CHECK (content_type IN ('image/png', 'image/jpeg')),
size_bytes integer NOT NULL CHECK (size_bytes BETWEEN 1 AND 10485760),
sha256 text NOT NULL,
status text NOT NULL DEFAULT 'ready' CHECK (status IN ('ready', 'failed')),
variants jsonb NOT NULL DEFAULT '[]'::jsonb,
error_code text,
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
updated_at timestamptz NOT NULL DEFAULT clock_timestamp(),
FOREIGN KEY (chat_id, owner_id) REFERENCES chat_members(chat_id, user_id)
);
CREATE INDEX attachments_recent ON attachments(created_at, id);
ALTER TABLE messages ADD COLUMN attachment_ids uuid[] NOT NULL DEFAULT ARRAY[]::uuid[];