Files
OmniRoute/src/lib/db/migrations/170_log_export_destinations.sql
Damian Pozimski 385e90f444 feat(dashboard): continuous call-log export to pluggable destinations (BigQuery first) (#11945)
Feature grande e bem construída: exportação contínua de call logs para destinos plugáveis (BigQuery primeiro). Revisei especificamente o tratamento de segredos (`src/lib/logExport/secrets.ts`) e a migração — encryption gate real (`requiresEncryptionKey` recusa gravação em texto plano quando `STORAGE_ENCRYPTION_KEY` não está setada), redação antes de qualquer resposta de API, e a migração cria a tabela com `enabled=0`/`include_bodies=0` por padrão (opt-in, sem exportar nada até o operador configurar). 62/62 testes focados verdes, typecheck limpo.

Resolvido o conflito com o barrel `src/lib/localDb.ts` (removido nesta mesma sessão, #11795 fase 5 — todo consumidor já migrado para `src/lib/db/*`); a PR só adicionava um re-export nele, que não é mais necessário. Obrigado pela contribuição!
2026-08-30 09:16:52 -03:00

21 lines
692 B
SQL

CREATE TABLE IF NOT EXISTS log_export_destinations (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
type TEXT NOT NULL,
enabled INTEGER NOT NULL DEFAULT 0,
config TEXT NOT NULL DEFAULT '{}',
batch_size INTEGER NOT NULL DEFAULT 500,
include_bodies INTEGER NOT NULL DEFAULT 0,
max_body_bytes INTEGER NOT NULL DEFAULT 262144,
max_rows_per_run INTEGER NOT NULL DEFAULT 10000,
cursor_row_id INTEGER NOT NULL DEFAULT 0,
exported_total INTEGER NOT NULL DEFAULT 0,
last_run_at TEXT,
last_status TEXT,
last_error TEXT,
created_at TEXT NOT NULL,
updated_at TEXT NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_log_export_destinations_enabled
ON log_export_destinations(enabled);