docs: changelog + README updates for batch A (migrations, CI, B14/B15/B17)

This commit is contained in:
2026-09-14 19:38:16 +08:00
parent b63d50e04b
commit 26111e73af
3 changed files with 51 additions and 2 deletions
+16 -1
View File
@@ -68,7 +68,22 @@ Book files: move the contents of the old host `./library/` into `deploy/api/stor
## Read this before changing the schema
`db.Migrate` only runs the `CREATE TABLE IF NOT EXISTS` statements of `schema.sql` — column adds/changes **do not take effect** on existing databases. Before any column change, introduce a `schema_migrations` version table + ordered migrations, otherwise old deployments silently run on the old shape.
Schema changes go through the ordered migration system in `backend/internal/db/migrations/`:
1. Create a new file: `NNNN_description.sql` (four-digit sequence number, lowercase snake_case).
2. Never modify an already-applied migration file — they are immutable.
3. No down migrations: rollback via database backup, fix-forward.
4. Existing databases are auto-baselined on first startup (0001 marked applied without re-running DDL).
5. Migrations run with `pg_advisory_lock` so `--scale api=N` replicas serialize safely.
Local gate before each batch merge: `go vet ./... && gofmt -l . && go test -p 1 -count=1 ./...` with dev PG+Redis running.
## CI
- Workflow: `.github/workflows/ci.yml` (standard GitHub Actions syntax, Gitea Actions compatible).
- **Gitea**: register an `act_runner` instance, enable Actions in repo settings. Works out of the box.
- **GitHub**: works out of the box.
- Until a runner is registered, run the local gate manually before merging.
## PWA