-- depends_on: room_message
CREATE TABLE IF NOT EXISTS message_star (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    message UUID NOT NULL,
    room UUID NOT NULL REFERENCES room(id),
    "user" UUID NOT NULL,
    created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
    UNIQUE (message, "user")
);

CREATE INDEX IF NOT EXISTS idx_message_star_user_room ON message_star ("user", room);
CREATE INDEX IF NOT EXISTS idx_message_star_message ON message_star (message);
