apps/docs/content/docs/guides/switch-to-prisma-postgres/from-neon.mdx
This guide walks you through migrating data from Neon to Prisma Postgres using pg_dump and pg_restore.
A Neon database connection URL
A Prisma Data Platform account
PostgreSQL CLI tools (pg_dump, pg_restore) version 17
If you don't have them installed, install PostgreSQL 17 client tools:
# macOS
brew install libpq
brew link --force libpq
# Debian / Ubuntu
sudo apt-get install postgresql-client-17
# Windows (via installer)
# Download from https://www.postgresql.org/download/windows/
# Select "Command Line Tools" during installation
:::info[Make sure your PostgreSQL tools match the Prisma Postgres version]
Prisma Postgres runs PostgreSQL 17. Run pg_dump --version or pg_restore --version to confirm.
:::
Once provisioned, get your direct connection string:
postgres:// — you'll need this in step 3.Copy a non-pooled connection string from Neon (disable Connection pooling) and ensure it includes sslmode=require:
postgresql://USER:PASSWORD@YOUR-NEON-HOST/DATABASE?sslmode=require
Export the connection string as an environment variable. Use single quotes so that special characters in your password (like !, $, or #) are not interpreted by the shell:
export NEON_DATABASE_URL='postgresql://USER:PASSWORD@YOUR-NEON-HOST/DATABASE?sslmode=require'
Then run:
pg_dump \
-Fc \
-d "$NEON_DATABASE_URL" \
-n public \
-f neon_dump.bak
Export your direct connection string from step 1 as an environment variable:
export PRISMA_POSTGRES_DATABASE_URL='postgres://...'
Then restore:
pg_restore \
--no-owner \
--no-acl \
-d "$PRISMA_POSTGRES_DATABASE_URL" \
neon_dump.bak
The --no-owner and --no-acl flags skip Neon-specific role assignments that don't exist in Prisma Postgres.
:::note
You can safely ignore the warning schema "public" already exists. The public schema is pre-created in every Prisma Postgres database, so the CREATE SCHEMA public command from the dump is redundant. Your data is still imported correctly.
:::
To validate the import, open Prisma Studio from the Studio tab in your project, or run:
npx prisma studio
Update DATABASE_URL in your .env file:
DATABASE_URL="postgres://USER:[email protected]:5432/?sslmode=require"
Then regenerate Prisma Client:
npx prisma generate
:::tip
See the Prisma ORM with Prisma Postgres quickstart for driver adapter configuration and best practices.
:::
Follow Add Prisma ORM to an existing project to introspect your database, generate a schema, and migrate your queries.