Files
mira/backend/migrations/007_chat_message_features.sql
Cauê Faleiros 0b920da187
All checks were successful
CI / backend (push) Successful in 13m8s
CI / frontend (push) Successful in 10m46s
CI / docker (push) Successful in 2m59s
Build post chat and attachment workflows
2026-06-08 16:44:33 -03:00

20 lines
800 B
SQL

ALTER TABLE calendar_item_chat_messages
ADD COLUMN IF NOT EXISTS edited_at TIMESTAMPTZ,
ADD COLUMN IF NOT EXISTS deleted_at TIMESTAMPTZ;
CREATE TABLE IF NOT EXISTS calendar_item_chat_attachments (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
chat_message_id UUID NOT NULL REFERENCES calendar_item_chat_messages(id) ON DELETE CASCADE,
original_filename TEXT NOT NULL,
stored_filename TEXT NOT NULL,
mime_type TEXT NOT NULL,
size_bytes BIGINT NOT NULL CHECK (size_bytes >= 0),
storage_driver TEXT NOT NULL,
storage_path TEXT NOT NULL,
created_by UUID REFERENCES users(id) ON DELETE SET NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_calendar_item_chat_attachments_message
ON calendar_item_chat_attachments (chat_message_id, created_at);