no-application-schema-check
Keep JSON shape and closed application value sets out of database CHECK constraints.
Why
A database CHECK that repeats an application-owned JSON schema or enum-like value set creates two validators that can drift and turn an otherwise valid application deployment into failed writes.
Fix
Remove the application-schema CHECK and validate the JSON payload or closed value set with the typed application boundary before writing it. Keep relational constraints such as foreign keys, uniqueness, nullability, and cross-column invariants in the database.
Examples
CREATE TABLE execution_plan ( outcomes JSONB NOT NULL CHECK ( JSONB_TYPEOF(outcomes) = 'array' AND JSONB_ARRAY_LENGTH(outcomes) BETWEEN 1 AND 10 ));CREATE TABLE execution_plan ( call_id UUID PRIMARY KEY REFERENCES CALL (id), outcomes JSONB NOT NULL);CREATE TABLECALL ( status TEXT NOT NULL CHECK (status IN ('queued', 'completed')));CREATE TABLECALL (status TEXT NOT NULL);