botserver/migrations/6.3.0-01-kb-fail-state/up.sql
Rodrigo Rodriguez (Pragmatismo) d3673e1f34
All checks were successful
BotServer CI/CD / build (push) Successful in 48s
Add KB fail state migration: fail_count and last_failed_at columns
New migration 6.3.0-01-kb-fail-state to add columns to kb_documents
for intelligent backoff retry logic.
2026-04-12 09:43:47 -03:00

14 lines
516 B
SQL

-- ============================================
-- KB Documents Fail State
-- Version: 6.3.0
-- ============================================
-- Add fail_count and last_failed_at to kb_documents
-- for intelligent backoff retry logic
ALTER TABLE kb_documents
ADD COLUMN IF NOT EXISTS fail_count INT NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS last_failed_at TIMESTAMPTZ;
CREATE INDEX IF NOT EXISTS idx_kb_documents_fail
ON kb_documents(bot_id, collection_name, fail_count)
WHERE fail_count > 0;