dbHouses database migrations, types and configuration for running a local PostgreSQL instance.
Starts a postgres:18 container (requires Docker), applies all migrations, seeds it, and publishes it on port 54332, the port .env.local's DATABASE_URL names.
It runs in the foreground: leave it in a terminal and press Ctrl-C to stop and remove the container.
bun nx run db:start
Every start is a fresh container, so migrations and seed are re-applied from scratch on each boot. To pick up a new migration, Ctrl-C and start again. (This is why there is no separate reset or stop target.)
Seed scripts (seed/*.sql) are applied automatically on every start. To boot without them:
bun nx run db:start:skip-seed
To get an empty database (schemas only) for dbmate to migrate into, as the PR dbmate job does:
bun nx run db:start:bare
The containers run on rootless Podman (podman machine start if db:start cannot reach it). Podman forwards the ports to localhost, so DATABASE_URL and VALKEY_URL stay on 127.0.0.1.
This will generate a blank migration file within the migrations directory.
bun nx run db:migrate-new <name>
bun nx run db:migrate-up
bun nx run db:migrate-down
bun nx run db:migrate-status
bun nx run db:migrate-dump
To add seed data to the database, you can create .sql scripts within the seed directory.
Running the start target on this project will automatically seed the database using these seed scripts.
This data will only be inserted into the local instance.
The cluster, proxy, cache and workload roles are the cfx-db Pulumi stack in packages/aurora, which also generates test/fixtures/workload-roles.*.sql.