Files
silo-server/migrations/sql/20260720084550_client_diagnostic_reports.sql
T
Quick104andClaude Fable 5 4fa84a661a feat(diagnostics): client diagnostics server foundation
Implements slice 1 of docs/design/2026-07-19-client-diagnostics.md: the
versioned contract (schemas, fixtures, Go validator), storage-validated
diagnostics.uploads_enabled gate, account-scoped status endpoint, hardened
streaming multipart ingest with quota reservation and a receiving/ready/
failed report state machine, S3 streaming puts, acting-admin report API
(list/detail/download/delete with audit events), and the retention +
orphan-reconciliation cleanup task.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XppCCycoaskCsW7ja1fZct
2026-07-20 11:13:52 -04:00

32 lines
1.0 KiB
SQL

-- +goose Up
CREATE TABLE client_diagnostic_reports (
id UUID PRIMARY KEY,
short_id TEXT NOT NULL,
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
profile_id TEXT,
state TEXT NOT NULL,
captured_at TIMESTAMPTZ NOT NULL,
received_at TIMESTAMPTZ NOT NULL DEFAULT now(),
report_type TEXT NOT NULL,
platform TEXT NOT NULL,
app_version TEXT NOT NULL,
crash_summary TEXT,
manifest JSONB NOT NULL,
playback_session_ids TEXT[] NOT NULL DEFAULT '{}',
blob_bucket TEXT,
blob_key TEXT,
blob_bytes BIGINT,
uncompressed_bytes BIGINT,
blob_sha256 TEXT
);
CREATE UNIQUE INDEX client_diagnostic_reports_short_id_lower_idx
ON client_diagnostic_reports (lower(short_id));
CREATE INDEX client_diagnostic_reports_user_received_idx
ON client_diagnostic_reports (user_id, received_at DESC);
CREATE INDEX client_diagnostic_reports_received_idx
ON client_diagnostic_reports (received_at);
-- +goose Down
DROP TABLE IF EXISTS client_diagnostic_reports;