Migrate from Heroku Postgres to FoundryDB in 10 Minutes
Heroku wound down its free tier in November 2022, and since then the managed Postgres add-on has remained a solid but limited option. If you have been hitting walls with single-engine lock-in, basic monitoring dashboards, no point-in-time recovery on lower plans, and the lack of multi-node high availability, it may be time to move. FoundryDB gives you a full-featured PostgreSQL service (plus six other engines) with automated HA, PITR, predictive autoscaling, and EU-hosted infrastructure, all manageable from a single CLI.
This guide walks you through a complete migration from Heroku Postgres to FoundryDB. The entire process takes about 10 minutes for a typical application database.
Why Migrate from Heroku Postgres?
Heroku Postgres serves many teams well for getting started, but production workloads often outgrow it:
- Single engine only. Heroku offers PostgreSQL and nothing else. If your architecture needs Redis-compatible caching, Kafka for event streaming, or MongoDB for document storage, you need separate providers.
- No multi-node HA on standard plans. Automatic failover requires Premium or Enterprise tiers. On Standard plans, a hardware failure means downtime.
- Basic monitoring. Heroku provides pg:info and a simple dashboard. There is no query-level performance analysis, no predictive autoscaling, and no custom alerting rules.
- No point-in-time recovery on lower tiers. PITR is only available on Premium plans and above. Standard plans get periodic snapshots with potential data loss windows.
- US-centric infrastructure. Heroku runs on AWS, primarily in the US. EU data residency requires careful plan selection and comes at a premium.
FoundryDB addresses all of these: seven database engines on one platform, multi-node HA from day one, PITR on every plan, predictive autoscaling, and EU-hosted infrastructure by default.
Prerequisites
Before starting, make sure you have:
- Heroku CLI installed and authenticated (
heroku login) - A FoundryDB account at foundrydb.com
- The fdb CLI installed (
brew install foundrydb/tap/fdbor download from the dashboard) - pg_restore available locally (comes with any PostgreSQL client installation)
Step 1: Export Your Database from Heroku
First, capture a fresh backup of your Heroku Postgres database:
# Capture a new backup
heroku pg:backups:capture --app my-heroku-app
# Download the backup to your local machine
heroku pg:backups:download --app my-heroku-app
This creates a file called latest.dump in your current directory. The file is in PostgreSQL's custom dump format, which supports parallel restore and selective table restoration.
For larger databases, you can check the backup size before downloading:
heroku pg:backups --app my-heroku-app
Step 2: Create a PostgreSQL Service on FoundryDB
Create a new PostgreSQL instance using the FoundryDB CLI:
fdb create \
--database-type postgresql \
--version 17 \
--plan-name tier-2 \
--storage-size-gb 50 \
--name my-app-db \
--zone se-sto1
This provisions a PostgreSQL 17 instance with 2 vCPUs, 4 GB RAM, and 50 GB of NVMe storage. The service is ready in about 3 to 5 minutes. You can monitor the provisioning status:
fdb status my-app-db
Wait until the status shows Running before proceeding.
Step 3: Get Your Connection Details
Retrieve the connection string for your new database:
fdb connect my-app-db --info
This outputs the host, port, username, password, and a full connection URI. Note the host (it will look like my-app-db-abc123.db.foundrydb.com), username, and password for the next step.
You can also reveal credentials for a specific user:
fdb users my-app-db --reveal-password
Step 4: Import Your Data
Use pg_restore to load the Heroku dump into your FoundryDB instance:
pg_restore \
--host my-app-db-abc123.db.foundrydb.com \
--port 5432 \
--username app_user \
--dbname defaultdb \
--no-owner \
--no-privileges \
--verbose \
latest.dump
Enter the password when prompted. The --no-owner and --no-privileges flags skip Heroku-specific role assignments that do not exist on your new instance.
For larger databases, use parallel restore to speed things up:
pg_restore \
--host my-app-db-abc123.db.foundrydb.com \
--port 5432 \
--username app_user \
--dbname defaultdb \
--no-owner \
--no-privileges \
--jobs 4 \
latest.dump
Step 5: Update Your Application's DATABASE_URL
Replace your Heroku database connection string with the FoundryDB one. The new URL follows standard PostgreSQL format:
postgresql://app_user:YOUR_PASSWORD@my-app-db-abc123.db.foundrydb.com:5432/defaultdb?sslmode=require
If your app reads DATABASE_URL from environment variables, update it in your deployment configuration. For example, in a Docker Compose setup:
environment:
DATABASE_URL: postgresql://app_user:YOUR_PASSWORD@my-app-db-abc123.db.foundrydb.com:5432/defaultdb?sslmode=require
FoundryDB uses auto-renewed TLS certificates, so sslmode=require (or verify-full) works out of the box with no certificate management on your part.
Step 6: Verify the Migration
Connect to your new database and run verification queries:
# Connect interactively
fdb connect my-app-db
# Or use psql directly
PGPASSWORD=YOUR_PASSWORD psql \
"host=my-app-db-abc123.db.foundrydb.com user=app_user dbname=defaultdb sslmode=require"
Run these checks to confirm everything migrated correctly:
-- Check table count
SELECT count(*) FROM information_schema.tables WHERE table_schema = 'public';
-- Check row counts for key tables
SELECT schemaname, relname, n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC
LIMIT 20;
-- Verify indexes exist
SELECT indexname, tablename FROM pg_indexes WHERE schemaname = 'public';
-- Test a representative query from your application
SELECT * FROM users LIMIT 5;
Compare the table count and row counts against your Heroku instance to confirm data integrity.
What You Gain After Migrating
Moving from Heroku Postgres to FoundryDB gives you immediate access to:
- 7 database engines. PostgreSQL, MySQL, MongoDB, Valkey, Kafka, OpenSearch, and Babelfish (SQL Server wire protocol). Manage everything from one dashboard and one CLI.
- Multi-node HA. Add read replicas and automatic failover with a single command. No plan upgrade required.
- Point-in-time recovery. Every plan includes continuous WAL archiving and PITR. Restore to any second within your retention window.
- Predictive autoscaling. FoundryDB monitors resource trends and scales compute and storage before you hit limits, not after.
- EU hosting by default. All infrastructure runs in European data centers (Stockholm), simplifying GDPR compliance.
- TLS auto-renewal. Certificates are provisioned and renewed automatically. No manual certificate management.
- Extensions ecosystem. Enable pgvector, PostGIS, TimescaleDB, and dozens of other extensions directly from the dashboard or CLI.
- Real-time query analytics. Monitor slow queries, connection counts, replication lag, and custom metrics with built-in dashboards and alerting.
The migration is a one-time effort. Once your data is on FoundryDB, you have a modern database platform that scales with your application.