CREATE TABLE IF NOT EXISTS mentions ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), message_id uuid NOT NULL REFERENCES messages (id) ON DELETE CASCADE, target_type text NOT NULL CHECK (target_type IN ('user', 'channel', 'here')), target_id uuid );