-- ============================================================
-- Migration 022: Categoria de templates WhatsApp
-- Tabela: whatsapp_templates
-- ============================================================

ALTER TABLE whatsapp_templates
  ADD COLUMN IF NOT EXISTS category VARCHAR(40) NOT NULL DEFAULT 'UTILITY';

UPDATE whatsapp_templates
SET category = 'UTILITY'
WHERE category IS NULL OR category = '';

CREATE INDEX IF NOT EXISTS idx_whatsapp_templates_category
  ON whatsapp_templates (category);
