Database architecture
Versioned migration
Apply an ordered schema change once; preserve applied checksums. Source-reviewed PostgreSQL/Spring lab or manual procedure, NOT RUN.
Formal Syntax & Structure
java syntaxjava
V1__inventory.sqlWorking Example
Example Snippetjava
CREATE TABLE inventory ( sku text PRIMARY KEY, stock integer NOT NULL CHECK (stock >= 0), version bigint NOT NULL DEFAULT 0 CHECK (version >= 0));INSERT INTO inventory(sku, stock) VALUES ('B1', 5), ('B2', 8);CREATE TABLE reservation ( request_id text PRIMARY KEY, sku text NOT NULL REFERENCES inventory(sku), quantity integer NOT NULL CHECK (quantity > 0));