GuidesImports & Migrations
Migrate from Heroku Postgres
Move a Heroku Postgres database into CapyDB.
Get the source connection string
The reliable way is the CLI:
heroku pg:credentials:url DATABASE -a your-appThis prints the full connection URL (and the individual fields). heroku config:get DATABASE_URL -a your-app works too, but pg:credentials:url is explicit about which credential you are getting on multi-credential databases.
postgres://user:password@ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com:5432/dbnameHeroku-specific caveats
- Credentials rotate. Heroku rotates database credentials on certain maintenance events — grab the URL right before the import window, not the day before.
- TLS is required on Heroku Postgres; the importer's automatic
sslmode=requirematches. Heroku's server certificates are not always verifiable by hostname, which is fine forrequire. - Essential-tier databases (formerly mini/basic) have row limits but are small by definition — they fit any CapyDB plan.
- Extensions: Heroku enables few by default;
pg_stat_statementsis common and allowlisted. If you usedpostgisor other non-allowlisted extensions, the preflight will say so.
Preflight
capydb import preflight --source-url "$(heroku pg:credentials:url DATABASE -a your-app | grep -o 'postgres://[^ ]*')"(or paste the URL into the dashboard's Import panel).
Import
Put the app in maintenance mode so writes stop:
heroku maintenance:on -a your-app
capydb import --source-url "postgres://..." --recreate --waitAfter the import
- Spot-check sequences.
\dxfor extensions.ANALYZE;- Point the app at CapyDB (
heroku config:set DATABASE_URL=...if the app stays on Heroku, noting some buildpacks expect the Heroku-managed var; otherwise set env wherever the app now runs), thenheroku maintenance:off.