CI integration
Commit your SQL and the generated Go in the same commit. In CI, start a fresh database, apply your
migrations, run plainsql check, and then run your tests.
Run the blog checks
Section titled “Run the blog checks”The blog example has Make targets for each step. They need Go 1.27, Docker, and the same PlainSQL version you used to generate the code locally:
# From examples/blog:set -euexport DEVDB_CONTAINER_NAME="plainsql-blog-ci-$$"trap 'make db-down' EXITmake db-upmake migratemake checkmake testThe example reads the connection string from the Docker container it starts. If your CI runner
provides Postgres, put its connection string in DATABASE_URL before you run your migrations and
plainsql check.
What fails the build
Section titled “What fails the build”| Change | Check |
|---|---|
| A migration breaks a query | Query analysis fails against the migrated schema. |
| SQL or generator settings changed without regeneration | Expected output differs from the committed files. |
| A removed query left an old generated file | The output directory contains an unexpected file. |
| Application code no longer matches the generated API | Go compilation or tests fail. |
When check fails, run plainsql generate locally, review the diff, and commit the updated files.
Do not regenerate in CI before the check. That would hide the fact that the committed files were out
of date.