Files
EvoBGP/migrations/postgres/000024_postgres_monitoring.up.sql
T
Denozordec fad2bd3353
CI / changes (push) Successful in 9s
CI / commitlint (push) Has been skipped
CI / openapi (push) Successful in 26s
CI / web (push) Successful in 33s
CI / go (push) Successful in 2m11s
CI / bird2 (push) Successful in 16s
CI / release (push) Successful in 3m27s
feat(db): implement PostgreSQL monitoring and maintenance features
Added PostgreSQL monitoring and maintenance capabilities to the API, including new endpoints for instance-level metrics, maintenance operations, and job scheduling. Updated the HTTP API to support PostgreSQL monitoring routes and integrated a background scheduler for metrics collection. Enhanced the CLI with database commands for maintenance tasks. Updated documentation to reflect these changes.
2026-06-01 13:43:33 +07:00

30 lines
939 B
SQL

CREATE TABLE IF NOT EXISTS postgres_monitor_snapshot (
id TEXT PRIMARY KEY,
collected_at TIMESTAMPTZ NOT NULL,
payload_json JSONB NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_postgres_monitor_snapshot_collected
ON postgres_monitor_snapshot (collected_at DESC);
CREATE TABLE IF NOT EXISTS postgres_maintenance_audit (
id TEXT PRIMARY KEY,
tenant_id TEXT,
actor_prefix TEXT,
kind TEXT NOT NULL,
target_table TEXT,
dry_run BOOLEAN NOT NULL DEFAULT false,
status TEXT NOT NULL,
detail_json JSONB,
error_message TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
started_at TIMESTAMPTZ,
finished_at TIMESTAMPTZ,
CONSTRAINT postgres_maintenance_audit_status_chk CHECK (
status IN ('queued', 'running', 'succeeded', 'failed', 'cancelled')
)
);
CREATE INDEX IF NOT EXISTS idx_postgres_maintenance_audit_created
ON postgres_maintenance_audit (created_at DESC);