-- 009_chat_reply.sql
-- Ajout du support des réponses aux messages (reply-to)
-- Idempotente via IF NOT EXISTS / ADD COLUMN IF NOT EXISTS

ALTER TABLE chat_messages
    ADD COLUMN IF NOT EXISTS reply_to_id INTEGER NULL
        REFERENCES chat_messages(id) ON DELETE SET NULL;

CREATE INDEX IF NOT EXISTS idx_chat_messages_reply_to
    ON chat_messages(reply_to_id);
