CREATE TABLE IF NOT EXISTS room_message_edit_history
(
    id          UUID PRIMARY KEY,
    message     UUID                     NOT NULL,
    "user"      UUID                     NOT NULL,
    old_content TEXT                     NOT NULL,
    new_content TEXT                     NOT NULL,
    edited_at   TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS idx_room_message_edit_history_message ON room_message_edit_history (message);
CREATE INDEX IF NOT EXISTS idx_room_message_edit_history_user ON room_message_edit_history ("user");
