This commit is contained in:
2026-11-16 09:28:38 +03:00
parent 276dbdad8a
commit 580b33efe8
99 changed files with 23335 additions and 27 deletions
+12
View File
@@ -0,0 +1,12 @@
CREATE TABLE message_attachments (
message_id uuid NOT NULL REFERENCES messages(id) ON DELETE CASCADE,
attachment_id uuid NOT NULL REFERENCES attachments(id),
position integer NOT NULL CHECK (position >= 0 AND position < 10),
PRIMARY KEY (message_id, attachment_id)
);
CREATE INDEX message_attachments_attachment_idx
ON message_attachments (attachment_id);
CREATE UNIQUE INDEX message_attachments_order_idx
ON message_attachments (message_id, position);