-- Migration 005: kb_source gains a one-line description + AI-classification timestamp.
--
-- Task Master #20 (v0.8.0). The classifier (api/services/kb/classifier.py)
-- returns a 40–200 char Hebrew summary for each uploaded document. It's
-- worth surfacing on search hit cards and in the management table, so we
-- store it as a permanent column on kb_source rather than only on the
-- ephemeral kb_ingest_job row. ai_classified_at marks AI-touched sources
-- for future audits / metrics; null for legacy rows.
--
-- Idempotent — wrapped in a single transaction.
--
-- Run as postgres superuser:
--   docker exec -i <pg-container> psql -U postgres -d insurance_kb \
--     -f /tmp/005_source_description.sql

BEGIN;

ALTER TABLE kb_source ADD COLUMN IF NOT EXISTS description TEXT;
ALTER TABLE kb_source ADD COLUMN IF NOT EXISTS ai_classified_at TIMESTAMPTZ;

COMMIT;
