Skip to content

Commit 6edf82e

Browse files
fix: Makefile DB targets follow POSTGRES_USER/DB; warn on POSTGRES_DB coupling
- make psql/backup/extensions derived DB_USER/DB_NAME from POSTGRES_USER/ POSTGRES_DB via $(or ...), so renaming them in .env no longer breaks targets - .env.example: note that changing POSTGRES_DB requires updating cron.database_name and pg_partman_bgw.dbname in postgresql.conf Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent eb05f55 commit 6edf82e

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ COMPOSE_PROJECT_NAME=local
1111
# ---- Database credentials --------------------------------------------------
1212
POSTGRES_USER=local_dev
1313
POSTGRES_PASSWORD=CHANGE_ME_use_a_strong_random_password
14+
# NOTE: if you change POSTGRES_DB, also update `cron.database_name` and
15+
# `pg_partman_bgw.dbname` in config/postgresql.conf to match (they're coupled).
1416
POSTGRES_DB=local_db
1517

1618
# ---- Networking ------------------------------------------------------------

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ endif
1111

1212
DC := docker compose
1313
SERVICE := postgres
14-
DB_USER ?= local_dev
15-
DB_NAME ?= local_db
14+
# Derive from .env (POSTGRES_USER/POSTGRES_DB) so renaming them never breaks
15+
# `make psql` / `backup` / `extensions`. Falls back to the defaults if unset.
16+
DB_USER ?= $(or $(POSTGRES_USER),local_dev)
17+
DB_NAME ?= $(or $(POSTGRES_DB),local_db)
1618
TS := $(shell date +%Y%m%d_%H%M%S)
1719

1820
.DEFAULT_GOAL := help

0 commit comments

Comments
 (0)