Migrate a local Postgres database to a managed Postgres service (Prisma Postgres)
Copy a PostgreSQL database from your laptop into Prisma Postgres in three steps: create the database in the Console, pg_dump, pg_restore. Every Postgres client you already use keeps working.
Prisma Postgres takes a PostgreSQL database from your laptop in three steps: create the database in the Prisma Console, pg_dump the source, pg_restore the file. This page creates the database in the Console because that needs nothing installed; to stay in a terminal, create the database from a terminal instead, which turns the first step into three commands. Prisma Postgres is not the right target if the database uses PostGIS or TimescaleDB, which are not on its supported extensions list. Prisma makes Prisma ORM, Prisma Postgres and Prisma Compute.
-
Create the database. In the Console, create a project with a Prisma Postgres database, open the database, click Connect to your database and then Generate new connection string. Copy both strings it shows. They have the same credentials and a different host:
pooled.db.prisma.iofor the application, anddb.prisma.ioforpg_restore,psqland migrations. -
Dump the local database. This writes a compressed archive of the local database
mydb; add-h,-pand-Uif it does not run on the default socket.Terminal pg_dump -Fc -d mydb -f mydb.dump -
Restore the archive over the direct connection, so the string you pass has
db.prisma.ioas its host.--no-ownerand--no-privilegesskip the ownership and grant statements that name roles from your laptop, which do not exist in Prisma Postgres.Terminal pg_restore --no-owner --no-privileges -d 'postgres://USER:PASSWORD@db.prisma.io:5432/postgres?sslmode=require' mydb.dump
Then set DATABASE_URL to the pooled string, and every Postgres client keeps working: Prisma ORM and Drizzle on the pooled string, psql and pgAdmin on the direct one. See Connecting to your database for why the two differ. Free plan, no credit card, PostgreSQL 17, connection pooling included.
- PostgreSQL 17 tools. Prisma Postgres runs PostgreSQL 17, so
pg_dump --versionandpg_restore --versionmust report17.x. A PostgreSQL 17pg_dumpreads older servers. It cannot dump a PostgreSQL 18 server, and the full import guide states that moving from 18 needs a separate downgrade-compatible process, which this page does not cover. - Extensions. Compare
SELECT extname FROM pg_extension;on the source with the supported extensions. PostGIS and TimescaleDB are not on the list. - Roles and policies.
pg_dumpdoes not copy roles, so a row-level security policy that names a local role fails on restore. Record those policies before you dump and recreate them afterwards; the full guide's export step and restore step show how to omit them from the restore.
Create the database from a terminal
If you would rather not open the Console, sign in, create a project and create the database with the Prisma CLI. That turns the first step into three commands, and the whole import into five.
npx prisma auth login
npx prisma project create my-app
npx prisma postgres create mydbauth login signs you in through the browser. project create creates a project and links the current directory to it, because every database belongs to a project; if the project already exists, skip this command and pass --project <name> to postgres create. postgres create creates the database and prints its connection string once, so copy it, and --region picks the region. If the string it prints has pooled.db.prisma.io as its host, keep it for the application, and for pg_restore swap the host to db.prisma.io and keep the rest.
The one-line import
For a small database, pipe the dump straight into the restore and skip the file:
pg_dump -Fc -d mydb | pg_restore --no-owner --no-privileges -d 'postgres://USER:PASSWORD@db.prisma.io:5432/postgres?sslmode=require'The file version above is the better choice when the database is large or a restore fails halfway, because pg_restore --list mydb.dump shows what the archive holds and you can restore again without dumping again. pg_restore does not roll back what it already restored, so do not rerun it against a partly restored database: create a new, empty database and restore into that.
Verify the import
Refresh the planner statistics and spot-check a table over the direct connection:
psql 'postgres://USER:PASSWORD@db.prisma.io:5432/postgres?sslmode=require' \
-c 'ANALYZE;' \
-c 'SELECT count(*) FROM "User";'Run the same count against the local database. The full import guide has a query that counts every table in both databases and diffs the two results.
Moving from Neon or Supabase?
The same dump and restore works from a hosted database. The Neon guide covers selecting the branch and the unpooled endpoint, and the Supabase guide lists what does not move with the data: Auth users, Storage objects and Edge Functions.
The dump is a snapshot of the source at the moment pg_dump runs, so stop or drain writes to the source before the final dump and keep them stopped until you have verified the import and switched the application over, as the full guide's export step spells out. If you cannot pause writes for that long, this snapshot process is not the right fit: you need a separately tested process that captures and replays every write made after the snapshot.
Put the app online too
Prisma Compute hosts TypeScript apps (Node.js, Bun or Next.js) next to Prisma Postgres. An existing repository adds a Prisma Composer declaration, a service.ts and a module.ts; Composer is in Early Access, and the porting page has a prompt your coding agent can write the files from. Then run your build, and npx prisma deploy module.ts provisions the service. To deploy on push, connect the repository and add the prisma/cloud-deploy-action workflow as shown in Deploy on push. From then on a push to the default branch updates production, and every other branch gets a preview with its own database, built from your migrations. The Compute FAQ lists what Compute does not do yet.
Do I need to change my ORM?
No, because Prisma Postgres is standard PostgreSQL behind a connection string: Prisma ORM 8, Prisma ORM 7, Drizzle, Kysely, TypeORM, node-postgres and psql connect as before. Give the application the pooled string and the CLI tools the direct one; Connecting to your database shows the setup for each runtime.
Does it cost anything?
The Free plan includes 200k operations a month and 50 databases, with no credit card, no time limit and no usage billing. Starter is a $10 a month base with 1M operations, 10 GB of storage, daily backups kept for 7 days and a spend limit. See pricing.
Can I try it without an account?
Yes, with npx create-db@latest, which creates a temporary database with no sign-up and deletes it after 24 hours unless you claim it. Use it to rehearse the restore with throwaway data, never for the real copy. See create-db.
Related pages
- Import from PostgreSQL: the full eight-step guide, with the production cutover, the restore manifest and the row-count diff
- Import from MySQL
- Connecting to your database
- Backups
- Move a local Postgres database online (2026): Prisma Postgres, Neon, Render, Railway and Supabase compared on the steps to a restored database and on what a free database left idle does
