diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index bb4b9ce..088d98d 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -8,6 +8,13 @@ services: POSTGRES_PASSWORD: ${DB_PASSWORD:-corrosion_dev} volumes: - pg_data:/var/lib/postgresql/data + # Auto-build the schema on a FRESH database. Postgres runs these ONLY when + # the data dir is empty (first boot or after a volume reset), so it never + # touches an existing volume — it just makes a fresh DB self-heal: the full + # schema is applied in order from the sqlx migrations (001..NNN), then the + # API's bootstrap seeds the admin. Rebuilds (with the volume kept) are a + # no-op here; the data persists. Only `down -v` / volume prune loses data. + - ../backend/migrations:/docker-entrypoint-initdb.d:ro ports: - "8101:5432" healthcheck: