fix: a rollback never stops the database from starting; schema changes are migration files
schema.sql dropped and re-added three CHECK constraints on every start, so an older image narrowed the lists and failed on rows written by a newer one (an Expedição user, for example). They are now created only when missing, and app/migrate.py applies timestamped files from app/migrations/ once each, recording them in dtf_local.migrations; an older image skips names it does not know. The first migration sets today's full lists. A CI step rehearses the rollback on the real database inside a rolled-back transaction. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,7 @@ jobs:
|
||||
deploy.test_production_preflight \
|
||||
tests.test_pricing \
|
||||
tests.test_coupons \
|
||||
tests.test_migrate \
|
||||
tests.test_secrets -v
|
||||
sh -n infra/lock_dependencies.sh
|
||||
|
||||
@@ -67,6 +68,12 @@ jobs:
|
||||
$COMPOSE up --build -d --wait --wait-timeout 600
|
||||
$COMPOSE ps
|
||||
|
||||
# The database never blocks a rollback. Runs in db-init, the only job
|
||||
# with the administrator connection; the whole test is rolled back, so
|
||||
# nothing it inserts or alters remains.
|
||||
- name: Rollback and migrations
|
||||
run: $COMPOSE run --rm --no-deps db-init python -m tests.migrations_test
|
||||
|
||||
# Run inside the stack's own network. The runner is itself a container, so
|
||||
# ports published on the host's loopback are in a different namespace and
|
||||
# unreachable from here. SITE_HOST_HEADER keeps the Host the gateway and
|
||||
|
||||
Reference in New Issue
Block a user