CREATE TABLE IF NOT EXISTS room_message ( id UUID PRIMARY KEY, seq BIGINT NOT NULL, room UUID NOT NULL, sender_type VARCHAR(255) NOT NULL, sender_id UUID, thread UUID, content TEXT NOT NULL, content_type VARCHAR(255) NOT NULL, edited_at TIMESTAMPTZ, send_at TIMESTAMPTZ NOT NULL, revoked TIMESTAMPTZ, revoked_by UUID ); CREATE INDEX idx_room_message_room_seq ON room_message (room, seq); CREATE INDEX idx_room_message_thread ON room_message (thread); CREATE INDEX idx_room_message_send_at ON room_message (send_at);