omnichannel-deploy/database/migrations/007_whatsapp_triage_state.sql

13 lines
586 B
MySQL
Raw Permalink Normal View History

-- ============================================================
-- Migration 007: Estado de triagem automatica do Omnino
-- Tabela: whatsapp_chat_atribuicoes
-- ============================================================
ALTER TABLE whatsapp_chat_atribuicoes
ADD COLUMN IF NOT EXISTS routing_attempts INTEGER NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS last_routed_message_id VARCHAR(255),
ADD COLUMN IF NOT EXISTS last_bot_sent_at TIMESTAMP WITH TIME ZONE;
CREATE INDEX IF NOT EXISTS idx_whatsapp_atribuicoes_triage
ON whatsapp_chat_atribuicoes (status, routing_attempts);