-- ============================================================================= -- E2E test database schema for the ``sientia_data`` namespace. -- -- Mirrors the production DDL one-to-one so any change in production can be -- pasted directly into this file. The conftest fixture drops the schema and -- loads this SQL into the testcontainers Postgres before every test. -- -- The gateway only touches ``sientia_data.predictions``: it updates -- ``write_status`` (contract C3, SIENTIAPDE-1975) on the row the Laborious -- inserted. Same DDL as ``sientia-dataops-laborious/e2e/db_schema.sql``. -- ============================================================================= CREATE SCHEMA IF NOT EXISTS sientia_data; -- ----------------------------------------------------------------------------- -- sientia_data.predictions -- ----------------------------------------------------------------------------- CREATE TABLE IF NOT EXISTS sientia_data.predictions ( model_id int4 NOT NULL, prediction numeric NULL, prediction_confidence numeric NOT NULL, response_time numeric NOT NULL, prediction_status text NOT NULL, "timestamp" timestamptz NOT NULL, created_at timestamptz DEFAULT CURRENT_TIMESTAMP NOT NULL, "comments" text NULL, metadata_id varchar(24) NULL, write_status text NULL, CONSTRAINT unique_model_id_timestamp UNIQUE (model_id, "timestamp"), CONSTRAINT chk_predictions_write_status CHECK (write_status IN ('pending', 'ok', 'error', 'session_bad')) );