PostgreSQL Database
Every App Platform plan includes a managed PostgreSQL 16 database.
Provisioning
Your database is provisioned automatically when your app is created (if your plan includes it). No manual setup needed.
Connection
The DATABASE_URL environment variable is automatically injected:
postgresql://user:password@host:5432/dbnameUsing in Your App
Node.js (with Prisma):
javascript
// prisma/schema.prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}Python (with SQLAlchemy):
python
import os
from sqlalchemy import create_engine
engine = create_engine(os.environ['DATABASE_URL'])Go:
go
db, err := sql.Open("postgres", os.Getenv("DATABASE_URL"))Backups
- Automated daily backups run every night
- Backups retained for 7 days
- Contact support for restore requests
Migrations
Run database migrations during deploy by adding to your Procfile:
release: npx prisma migrate deploy
web: node server.jsThe release process runs once before the web process starts.
Limitations
- No direct database access (no psql connection from your laptop)
- Access only through your application code
- Maximum database size depends on your plan's storage limit
- One database per app (contact support for additional databases)
Monitoring
Check database usage from the Metrics tab:
- Connection count
- Storage used
- Query performance (via your app's logging)