Dump a Postgres database from Supabase and restore it to Railway, using pg_dump / pg_restore from a Bun-based Docker container.
- Docker, or Bun 1.3+ with
postgresql-client-17installed locally.
Copy .env.example to .env and fill in the values:
cp .env.example .env| Variable | Required | Default |
|---|---|---|
SUPABASE_HOST |
yes | — |
SUPABASE_USER |
yes | — |
SUPABASE_PASSWORD |
yes | — |
SUPABASE_DB |
yes | — |
RAILWAY_HOST |
yes | — |
RAILWAY_PASSWORD |
yes | — |
RAILWAY_PORT |
no | 5432 |
RAILWAY_USER |
no | postgres |
RAILWAY_DB |
no | railway |
docker build -t bun-postgres-docker .
docker run --rm --env-file .env bun-postgres-dockerbun install
bun run start- Runs
pg_dumpagainst Supabase for thepublicanddrizzleschemas (custom format, no owner/ACL) intoprod_snapshot.dump. - Runs
pg_restore --clean --if-existsagainst Railway to apply the dump. - Creates
f_unaccent(text), anIMMUTABLEwrapper aroundextensions.unaccentso it can be used in functional indexes (e.g.CREATE INDEX ON formation (f_unaccent(lower(title)))).