Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

On this pageOverview

From v1 (Prisma ORM v6) (/docs/orm/v6/more/upgrades/from-v1)

For the complete Prisma documentation index, see llms.txt. A markdown version of any docs page is available by appending .md to its URL.

Upgrading your project from Prisma 1 to Prisma ORM 2 and later

Location: ORM > v6 > More > Upgrades > From v1

This guide helps you migrate from Prisma 1 to Prisma ORM version 2.x and later.

[!WARNING] Prisma 1 was sunset in 2020. This guide is provided for the remaining users who still need to migrate from Prisma 1 to modern Prisma ORM versions.

Main differences between Prisma 1 and Prisma ORM 2+

Section titled “Main differences between Prisma 1 and Prisma ORM 2+”

Prisma ORM 2.x and later versions:

  • Don't require hosting a database proxy server (i.e., the Prisma server)
  • Make the features of Prisma 1 more modular with dedicated tools:
    • Prisma Client: An improved version of Prisma Client 1.0
    • Prisma Migrate: Data modeling and migrations (formerly prisma deploy)
  • Use the Prisma schema, a merge of Prisma 1 datamodel and prisma.yml
  • Use its own modeling language instead of being based on GraphQL SDL
  • Don't expose a GraphQL API for your database—only allow programmatic access via Prisma Client
  • Allow connecting to any existing database via introspection

There are two main upgrade strategies:

  1. Upgrade all at once: Entirely remove Prisma 1 from your project and move everything over to Prisma ORM 2+ at once. Recommended for projects not yet in production or with little traffic.

  2. Gradual upgrade side-by-side: Add Prisma ORM 2+ to the existing Prisma 1 project and gradually replace existing Prisma 1 features while running them side-by-side. Recommended for high-traffic production applications.

  1. Install the Prisma ORM 2+ CLI as a development dependency
  2. Create your Prisma schema and configure the database connection URL
  3. Use the Prisma CLI to introspect your Prisma 1 database and generate your Prisma schema
  4. Run the Prisma 1 Upgrade CLI to fix schema incompatibilities
  5. Install and generate Prisma Client
  6. Adjust your application code, replacing Prisma Client 1.0 API calls with Prisma Client 2+ API calls

The database schema created by Prisma 1's prisma deploy is only partially compatible with Prisma ORM 2+. Here's an overview of common incompatibilities:

Problem SQL Fix Prisma Schema Fix Breaks Prisma 1
Default values aren't in database Yes Yes No
Generated CUIDs as IDs not in database No Yes No
@createdAt not in database Yes Yes No
@updatedAt not in database No Yes No
Inline 1-1 relations missing UNIQUE constraint Yes No No
All non-inline relations recognized as m-n Yes No Yes
Json type is TEXT in database Yes No Varies
Enums are TEXT in database Yes No Varies
Required 1-1 relations not in database No Yes No
Mismatching CUID length Yes No No
Scalar lists maintained with extra table Depends No Depends

The Prisma 1 Upgrade CLI helps you apply workarounds for schema incompatibilities. It generates SQL statements to fix the database schema and make it compatible with Prisma ORM 2+.

  1. Set up Prisma ORM by installing the CLI and running npx prisma init
  2. Connect to your database and introspect it with npx prisma db pull
  1. Invoke the Upgrade CLI with npx prisma-upgrade
  2. Run the generated SQL commands against your database
  3. Run prisma db pull again
  4. Run npx prisma-upgrade again
  5. The Upgrade CLI adjusts the Prisma schema by adding missing attributes

The Upgrade CLI is designed so you can stop and restart the process at any time. Once you run a SQL command, it won't show up the next time you invoke the Upgrade CLI.

After upgrading the Prisma layer, you need to update your application code. Choose the appropriate guide based on your current setup:

  • GraphQL Nexus users: Replace the old nexus-prisma plugin with the new nexus-plugin-prisma
  • prisma-binding users: Migrate to either Nexus or SDL-first GraphQL
  • REST API users: Replace Prisma Client 1.0 calls with Prisma Client 2+ calls

Prisma ORM 2+ does not have full feature parity with Prisma 1. The main missing feature is:

  • Real-time API (Subscriptions): Prisma ORM 2+ doesn't have built-in database subscriptions. For real-time functionality, consider using native database triggers or triggering GraphQL subscriptions manually inside mutation resolvers.

If you encounter issues during migration:

  1. Check the Prisma 1 Upgrade CLI repository for known issues
  2. Visit the Prisma Discord for community support
  3. Open an issue on GitHub for bugs
  • Older versions: Upgrade guides for Prisma ORM versions 3, 4, 5, and 6
  • Preview features: Upgrading your project to use a Preview feature.
  • To v7: Guide on how to upgrade to Prisma ORM 7
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu