-- 163_normalize_manual_newlines.sql
-- Normalize legacy literal "\\n" sequences in manual text fields to real newlines.

UPDATE manual_articles
SET
    content = REPLACE(content, E'\\n', E'\n'),
    summary = REPLACE(COALESCE(summary, ''), E'\\n', E'\n'),
    updated_at = CURRENT_TIMESTAMP
WHERE POSITION(E'\\n' IN content) > 0
   OR POSITION(E'\\n' IN COALESCE(summary, '')) > 0;

UPDATE manual_steps
SET
    content = REPLACE(content, E'\\n', E'\n'),
    updated_at = CURRENT_TIMESTAMP
WHERE POSITION(E'\\n' IN content) > 0;
