fieldlens-deploy/migrations/005_print_capture_diagnostics.sql
Admin 15007a4893
Some checks failed
CI / verify (push) Has been cancelled
CI / print-rust (push) Has been cancelled
feat(print): sync capture diagnostics after desktop login
2026-09-26 22:15:40 +00:00

21 lines
779 B
SQL

CREATE TABLE IF NOT EXISTS print_capture_diagnostics (
id uuid PRIMARY KEY,
tenant_id text NOT NULL REFERENCES tenants(id),
site_id uuid NOT NULL REFERENCES sites(id),
station_id uuid NOT NULL REFERENCES stations(id),
device_id uuid NOT NULL REFERENCES devices(id),
operator_subject text NOT NULL,
source text NOT NULL,
stream_format text NOT NULL,
byte_count bigint NOT NULL CHECK (byte_count >= 0),
barcode_count integer NOT NULL CHECK (barcode_count >= 0),
forwarded boolean NOT NULL,
failure_kind text,
app_version text NOT NULL,
captured_at timestamptz NOT NULL,
received_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_print_capture_diagnostics_tenant_time
ON print_capture_diagnostics(tenant_id, captured_at DESC);