# Migrate a local Postgres database to the cloud (Prisma Postgres) (/docs/postgres/import-from-existing-database) > For the complete Prisma documentation index, see [llms.txt](https://www.prisma.io/docs/llms.txt). A markdown version of any docs page is available by appending `.md` to its URL. Move a local or hosted PostgreSQL database to Prisma Postgres in three steps: create the database, pg_dump, pg_restore. Location: Postgres > Migrate a local Postgres database to the cloud (Prisma Postgres) Prisma Postgres takes a PostgreSQL database from your laptop in three steps: create the database in the [Prisma Console](https://console.prisma.io/?utm_source=docs\&utm_medium=content\&utm_content=postgres), `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](#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. The Free plan includes 2 GB of storage and 200k operations a month, with no credit card. 1. **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.io` for the application, and `db.prisma.io` for `pg_restore`, `psql` and migrations. 2. **Dump the local database.** This writes a compressed archive of the local database `mydb`; add `-h`, `-p` and `-U` if it does not run on the default socket. ```bash title="Terminal" pg_dump -Fc -d mydb -f mydb.dump ``` 3. **Restore the archive over the direct connection**, so the string you pass has `db.prisma.io` as its host. `--no-owner` and `--no-privileges` skip the ownership and grant statements that name roles from your laptop, which do not exist in Prisma Postgres. ```bash title="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](https://www.prisma.io/docs/postgres/database/connecting-to-your-database) for why the two differ. Free plan, no credit card, PostgreSQL 17, connection pooling included. > [!NOTE] > Check before you migrate > > * **PostgreSQL 17 tools.** Prisma Postgres runs PostgreSQL 17, so `pg_dump --version` and `pg_restore --version` must report `17.x`. A PostgreSQL 17 `pg_dump` reads older servers. It cannot dump a PostgreSQL 18 server, and the [full import guide](https://www.prisma.io/docs/prisma-postgres/import-from-existing-database-postgresql#prerequisites) 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](https://www.prisma.io/docs/postgres/database/postgres-extensions#supported-extensions). PostGIS and TimescaleDB are not on the list. > * **Roles and policies.** `pg_dump` does 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](https://www.prisma.io/docs/prisma-postgres/import-from-existing-database-postgresql#3-stop-source-writes-and-export-the-final-snapshot) and [restore step](https://www.prisma.io/docs/prisma-postgres/import-from-existing-database-postgresql#4-restore-into-prisma-postgres) show how to omit them from the restore. ## Create the database from a terminal [#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. ```bash title="Terminal" npx prisma auth login npx prisma project create my-app npx prisma postgres create mydb ``` `auth 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 ` 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 [#the-one-line-import] For a small database, pipe the dump straight into the restore and skip the file: ```bash title="Terminal" 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 [#verify-the-import] Refresh the planner statistics and spot-check a table over the direct connection: ```bash title="Terminal" 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](https://www.prisma.io/docs/prisma-postgres/import-from-existing-database-postgresql#5-verify-the-imported-data) has a query that counts every table in both databases and diffs the two results. ## Moving from Neon or Supabase? [#moving-from-neon-or-supabase] The same dump and restore works from a hosted database. The [Neon guide](https://www.prisma.io/docs/guides/switch-to-prisma-postgres/from-neon) covers selecting the branch and the unpooled endpoint, and the [Supabase guide](https://www.prisma.io/docs/guides/switch-to-prisma-postgres/from-supabase) lists what does not move with the data: Auth users, Storage objects and Edge Functions. PlanetScale Postgres uses the same dump and restore over a direct (non-PgBouncer) connection; [Prisma Postgres vs PlanetScale](https://www.prisma.io/compare/planetscale) is the head-to-head. 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](https://www.prisma.io/docs/prisma-postgres/import-from-existing-database-postgresql#3-stop-source-writes-and-export-the-final-snapshot) 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 [#put-the-app-online-too] [Prisma Compute](https://www.prisma.io/docs/compute) hosts TypeScript apps built for Node.js, Bun or Next.js next to Prisma Postgres; deployed apps run on Bun. An existing repository adds a [Prisma Composer (Early Access)](https://www.prisma.io/docs/composer) declaration, which is a `service.ts` per server, one `module.ts` and the deploy config in the `composer` section of `prisma.config.ts`. The server itself needs three changes: read the port from `service.port()` and bind `0.0.0.0`, turn its other `process.env` reads into service inputs or dependencies, and build the Postgres client from the injected `db.url`. The [porting page](https://www.prisma.io/docs/composer/porting-an-app) has a prompt your coding agent can make these changes 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](https://www.prisma.io/docs/compute/deploy-on-push). From then on a push to the default branch updates production, and every other pushed branch gets a preview with its own services and, for databases declared in the Composer module, its own new database; production data is not copied. If the app reads `DATABASE_URL`, the preview is only as separate as that value. The [Compute FAQ](https://www.prisma.io/docs/compute/faq#where-it-has-trade-offs) lists what Compute does not do yet. ## Do I need to change my ORM? [#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](https://www.prisma.io/docs/postgres/database/connecting-to-your-database) shows the setup for each runtime. ## Does it cost anything? [#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](https://www.prisma.io/pricing). ## Can I try it without an account? [#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](https://www.prisma.io/docs/postgres/npx-create-db). ## Related pages [#related-pages] * [Import from PostgreSQL](https://www.prisma.io/docs/prisma-postgres/import-from-existing-database-postgresql): the full eight-step guide, with the production cutover, the restore manifest and the row-count diff * [Import from MySQL](https://www.prisma.io/docs/prisma-postgres/import-from-existing-database-mysql) * [Connecting to your database](https://www.prisma.io/docs/postgres/database/connecting-to-your-database) * [Backups](https://www.prisma.io/docs/postgres/database/backups) * [Move a local Postgres database online (2026)](https://www.prisma.io/blog/from-local-to-production-with-prisma-postgres): Prisma Postgres, Neon, Render, Railway and Supabase compared on the steps to a restored database and on what a free database left idle does ## Related pages - [`Best Postgres for AI apps`](https://www.prisma.io/docs/postgres/best-postgres-for-ai-apps): Why Prisma Postgres works well for AI and LLM workloads: built-in pooling, edge connectivity, pgvector, and MCP support. - [`create-db`](https://www.prisma.io/docs/postgres/npx-create-db): Create a temporary Prisma Postgres database with one command and no sign-up, for prototypes, tests and coding agents. Claim it with a Prisma account to keep it. - [`Database`](https://www.prisma.io/docs/postgres/database): Overview of Prisma Postgres database operations, connections, pooling, backups, and query analysis. - [`Error reference`](https://www.prisma.io/docs/postgres/error-reference): Error reference documentation for Prisma Postgres - [`Migrate from Early Access`](https://www.prisma.io/docs/postgres/migrate-from-ea-to-ga): Move your Prisma Postgres Early Access database to a new PostgreSQL 17 database with dump and restore.