-- Migration 043: allow telemetry-only ollama_other provider
-- Date: 2026-06-01
--
-- Runtime code maps unresolved or unknown Ollama hosts to `ollama_other`.
-- This is not a routing target; it is an observability bucket for failures
-- that happen before a concrete GCP-A/GCP-B/111 host is selected.

BEGIN;

ALTER TABLE IF EXISTS ai_calls
    DROP CONSTRAINT IF EXISTS chk_ai_calls_provider;

ALTER TABLE IF EXISTS ai_calls
    ADD CONSTRAINT chk_ai_calls_provider
    CHECK (
        provider IN (
            'gcp_ollama',
            'ollama_secondary',
            'ollama_111',
            'ollama_other',
            'gemini',
            'claude',
            'nim',
            'openrouter',
            'nim_via_elephant'
        )
    ) NOT VALID;

COMMENT ON CONSTRAINT chk_ai_calls_provider ON ai_calls IS
    'Provider telemetry whitelist; ollama_other is unresolved/unknown Ollama host telemetry, not a route.';

COMMIT;
