-- Migration 141: Promote 'active' templates to 'published' (P43)
--
-- Three legacy templates (cookie_banner, impressum, privacy_policy)
-- were stored with status='active' from a March-2026 seed. The
-- list-templates API filters status='published' by default, so they
-- never appeared in the document-generator UI even though the data
-- was fine. Promoting them so users can see + use them.

BEGIN;

UPDATE compliance.compliance_legal_templates
SET status = 'published', updated_at = now()
WHERE status = 'active'
  AND document_type IN ('cookie_banner', 'impressum', 'privacy_policy');

COMMIT;
