Add a persisted field
- Add a new migration. Keep applied migrations unchanged. Define the default or backfill for existing rows before making the field required.
- Update the resource’s query SQL, domain input, and repository mapping.
- Update the OpenAPI input/output schemas, including bounds and optionality.
- Run
task generate, then map the generated types in the handler. Apply omitted-value defaults there; validation does not inject them into requests. - Test create, read, update, invalid values, explicit null, omitted defaults, and migration of existing rows.
- Run
go run ./cmd/dev checkandtask test:integration.
Migrations use increasing numeric versions. Renumber an unapplied migration if parallel branches chose the same version. Review rollback behavior before deployment, especially when it removes data.
A passing build does not prove persistence: write the field and read it back from the real test database.