fleet-platform/db/migrations/20260601000018_ops_contract_check_log.sql

32 lines
1,017 B
MySQL
Raw Normal View History

-- migrate:up
--
-- Append-only log of contract-check probes against the Tracksolid Pro API.
-- One row per (endpoint, attempt). The SLO worker reads this to compute
-- contract_drift_days = days since the most-recent successful probe for the
-- laggard endpoint. Threshold 1 day → red badge if any endpoint hasn't
-- validated cleanly in the last 24h.
CREATE SCHEMA IF NOT EXISTS ops;
CREATE TABLE ops.contract_check_log (
check_id bigserial PRIMARY KEY,
endpoint text NOT NULL,
target text,
success bool NOT NULL,
error_class text,
error_detail text,
sample jsonb,
parser_version text,
checked_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX contract_check_endpoint_time_idx
ON ops.contract_check_log (endpoint, checked_at DESC);
CREATE INDEX contract_check_success_time_idx
ON ops.contract_check_log (success, checked_at DESC);
-- migrate:down
DROP TABLE IF EXISTS ops.contract_check_log;