21 lines
779 B
SQL
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);
|