docs(deployment): rewrite migration prose for goose adoption
Backend CI / Test (push) Has been cancelled
Backend CI / Contract Tests (push) Has been cancelled
Backend CI / Build (push) Has been cancelled
Backend CI / Lint (push) Has been cancelled
Backend CI / Secret Scanning (push) Has been cancelled

Update the deployment book and glossary to reflect the goose-based
schema migration flow shipped in 12b2f9d/0f7450a:

- ch07: clarify startup probe assumes migrations ran out-of-band
- ch08: drop AutoMigrate-with-advisory-lock prose; describe goose Job
- ch12: pod startup checks goose_db_version, no longer runs migrations
- ch14: document the Job→wait→roll deploy gate and how to debug failures
- ch16: add "Migrate Job fails during deploy" + "Schema precondition
  failed" failure modes
- ch17: new runbook entries §26 (run migrations manually), §27 (recover
  from failed/dirty migration), §28 (bootstrap goose on fresh clone)
- ch19: postscript on §13 noting MigrateWithLock approach is superseded
- ch20: mark "Migration Job for schema changes" task done
- glossary: add `goose` and `goose_db_version`; flag AutoMigrate as
  tests-only
- references: add goose links; flag AutoMigrate as tests-only
This commit is contained in:
Trey t
2026-04-26 23:01:32 -05:00
parent 0f7450ada9
commit 8d9ca2e6ed
10 changed files with 260 additions and 39 deletions
+11 -1
View File
@@ -173,11 +173,21 @@ suffix. (Chapter 8)
## Go + Asynq
**AutoMigrate**: GORM function that syncs DB schema to Go structs.
(Chapter 8)
We used this in production until 2026-04, replaced by goose. Tests
still use it via `testutil.SetupTestDB`. (Chapter 8)
**Asynq**: Go library for background job queues. Redis-backed.
(Chapter 7)
**goose**: pressly/goose — the SQL migration tool we use in production
(commit 12b2f9d onward). Migration files live in `migrations/`, one
file per version with `-- +goose Up` / `-- +goose Down` markers.
(Chapter 8)
**goose_db_version**: goose's version-tracking table. One row per
applied migration. `RequireSchemaApplied` reads the latest row at
api/worker startup to fail fast on a stale schema. (Chapter 8)
**GORM**: Go ORM we use. (Chapter 8)
**pgx**: Go Postgres driver used by GORM. (Chapter 8)
+5 -1
View File
@@ -65,7 +65,9 @@ Every external link cited anywhere in this book, grouped by topic.
- [Neon usage-based pricing announcement][neon-blog]
- [Neon connect from any app][neon-connect]
- [Postgres advisory locks][pg-locks]
- [GORM AutoMigrate][gorm-automigrate]
- [GORM AutoMigrate][gorm-automigrate] (tests only — production migrations use goose)
- [pressly/goose — SQL migration tool][goose]
- [Goose documentation][goose-docs]
## Backblaze B2
@@ -168,6 +170,8 @@ Every external link cited anywhere in this book, grouped by topic.
[neon-connect]: https://neon.com/docs/connect/connect-from-any-app
[pg-locks]: https://www.postgresql.org/docs/current/explicit-locking.html#ADVISORY-LOCKS
[gorm-automigrate]: https://gorm.io/docs/migration.html
[goose]: https://github.com/pressly/goose
[goose-docs]: https://pressly.github.io/goose/
<!-- B2 -->
[b2-docs]: https://www.backblaze.com/docs/