Add KB fail state migration: fail_count and last_failed_at columns
All checks were successful
BotServer CI/CD / build (push) Successful in 48s

New migration 6.3.0-01-kb-fail-state to add columns to kb_documents
for intelligent backoff retry logic.
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-12 09:43:47 -03:00
parent 73f1898b62
commit d3673e1f34
2 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1,8 @@
-- ============================================
-- Rollback KB Fail State
-- ============================================
DROP INDEX IF EXISTS idx_kb_documents_fail;
ALTER TABLE kb_documents
DROP COLUMN IF EXISTS fail_count,
DROP COLUMN IF EXISTS last_failed_at;

View file

@ -0,0 +1,14 @@
-- ============================================
-- 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;