IndexNextPrisma Postgres
Import from PostgreSQL
Import an existing PostgreSQL database into Prisma Postgres, then use it with Prisma Next.
Move an existing PostgreSQL database into Prisma Postgres, then connect Prisma Next to it.
Prerequisites
You need:
- the connection URL for the PostgreSQL database you are importing from
- a Prisma Data Platform account
- PostgreSQL 17 CLI tools, including
pg_dumpandpg_restore - Node.js 24 or newer
1. Create a Prisma Postgres database
Create a Prisma Postgres database from Console or with the CLI. Copy the direct connection string; you will use it for the restore and for DATABASE_URL.
2. Export from PostgreSQL
Run pg_dump against the source database:
pg_dump -Fc -v -d "postgresql://USER:PASSWORD@HOST:PORT/DATABASE" -n public -f db_dump.bak3. Restore into Prisma Postgres
Restore the dump with the direct Prisma Postgres connection string:
pg_restore -d "postgres://USER:PASSWORD@db.prisma.io:5432/postgres?sslmode=require" -v ./db_dump.bak4. Add Prisma Next
From your app root, initialize Prisma Next:
bunx prisma-next initChoose PostgreSQL, set DATABASE_URL to the Prisma Postgres connection string, then infer and emit the contract:
bunx prisma-next contract infer --output ./prisma/contract.prisma
bunx prisma-next contract emit
bunx prisma-next db signNext steps
- Review the inferred contract before you rely on it in application code.
- Use the PostgreSQL existing-project guide for the first Prisma Next query.
- Use the full Prisma Postgres import guide for deeper migration details.