CICD-306 · PostgreSQL schema validation
Encyclopedia · Database delivery and migration · All snippets
Previous · CICD-305 · Next · CICD-307
1. Where it fits
- Placement CI run step or authorized lab terminal.
- Prerequisites disposable database, migration tools and a scoped database role.
- Platforms local-linux, github-actions, gitea-actions.
- Parameters
DATABASE_URL.
2. Copy the snippet
bash
psql "${DATABASE_URL:?}" -X -v ON_ERROR_STOP=1 -f tests/schema-invariants.sql3. How it works
The SQL client applies the named fixture or assertions against the selected database. ON_ERROR_STOP makes SQL errors fail the CI step.
4. Verify the result
Provide executable assertions that raise on missing relations or types. Use a scoped test DSN.
Validation syntax-validated (Bash parse). Status definitions.