CREATE TABLE IF NOT EXISTS attachments ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), message_id uuid NOT NULL REFERENCES messages (id) ON DELETE CASCADE, filename text NOT NULL, content_type text NOT NULL, size_bytes bigint NOT NULL, storage_key text NOT NULL );