The three-environment story
Most teams run three Postgres environments: local (developer machines), staging (a hosted clone for integration), production (the real one). The schema must be identical across all three; the data should not be.
What changes per environment
- Connection string (different host/credentials).
- Data (seed in dev, realistic-but-fake in staging, real in prod).
- Resource size (1GB on dev, 4GB on staging, whatever prod needs).
- Backup cadence (none on dev, hourly on staging, continuous on prod).
- SSL (off on local, required on staging/prod).
What must NOT change
- The schema (managed by migrations — same migrations, same order, same final state).
- The Postgres major version. Test on the same major you run in prod. Differences in planner, JSON path, generated columns can bite.
- The set of installed extensions.