Files
EvoFirewall/packages/db/migrations/016_webhooks.sql
T
Denozordec 9fa6269174
quality / changes (push) Successful in 7s
quality / commitlint (push) Skipped
quality / openapi (push) Successful in 30s
quality / web (push) Successful in 1m3s
quality / api (push) Successful in 1m15s
quality / linux-agent-smoke (push) Failing after 27s
quality / docker-check (push) Failing after 2m28s
CD / quality (push) Failing after 5m52s
CD / publish (push) Skipped
feat: harden firewall policies telemetry and operations
Implement reliable agent apply, telemetry v2, analytics retention, guarded rollouts, enrollment, labels and webhooks. Improve ReUI frontend data safety and bounded list loading, and add Docker smoke, recovery and resource checks. Document local verification and pending native acceptance.
2026-10-26 13:10:58 +07:00

23 lines
1.2 KiB
SQL

CREATE TABLE webhook_endpoints (
id TEXT PRIMARY KEY, name TEXT NOT NULL, url TEXT NOT NULL,
secret_cipher TEXT NOT NULL, enabled INTEGER NOT NULL DEFAULT 1,
generation INTEGER NOT NULL DEFAULT 1,
events_json TEXT NOT NULL, created_at TEXT NOT NULL, updated_at TEXT NOT NULL
);
CREATE TABLE webhook_deliveries (
id TEXT PRIMARY KEY, endpoint_id TEXT NOT NULL REFERENCES webhook_endpoints(id) ON DELETE CASCADE,
event_type TEXT NOT NULL, resource_id TEXT NOT NULL, payload_json TEXT NOT NULL,
endpoint_generation INTEGER NOT NULL DEFAULT 1,
status TEXT NOT NULL DEFAULT 'pending' CHECK(status IN ('pending','dead')),
attempts INTEGER NOT NULL DEFAULT 0, next_attempt_at TEXT NOT NULL,
created_at TEXT NOT NULL, last_error TEXT
);
CREATE INDEX idx_webhook_due ON webhook_deliveries(status,next_attempt_at);
CREATE TABLE webhook_transitions (
endpoint_id TEXT NOT NULL REFERENCES webhook_endpoints(id) ON DELETE CASCADE,
event_type TEXT NOT NULL, resource_id TEXT NOT NULL, state TEXT NOT NULL,
last_emitted_at TEXT, PRIMARY KEY(endpoint_id,event_type,resource_id)
);
CREATE TABLE webhook_metrics (id INTEGER PRIMARY KEY CHECK(id=1), dropped INTEGER NOT NULL DEFAULT 0);
INSERT INTO webhook_metrics(id) VALUES (1);