← Back to the chapter · Previous detail · Next detail →

Technical detail · Storage Design Case Studies

Versioned sensor contracts

Each sensor type and schema version identifies effective time, field and unit contracts, and notes.

CREATE TABLE sensor_schema_versions (
    sensor_type     TEXT        NOT NULL,
    schema_version  INTEGER     NOT NULL,
    effective_from  TIMESTAMPTZ NOT NULL,
    field_contract  JSONB       NOT NULL,
    unit_contract   JSONB       NOT NULL,
    notes           TEXT,
    PRIMARY KEY (sensor_type, schema_version)
);

← Back to the chapter · Previous detail · Next detail →