forked from mtusi2026/mtusi2026lab6
lab6
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user