Deploy migrations from a local environment (Prisma ORM v6) (/docs/orm/v6/prisma-client/deployment/deploy-migrations-from-a-local-environment)
For the complete Prisma documentation index, see llms.txt. A markdown version of any docs page is available by appending
.mdto its URL.
Learn how to deploy Node.js and TypeScript applications that are using Prisma Client locally.
Location: ORM > v6 > Prisma Client > Deployment > Deploy migrations from a local environment
There are two scenarios where you might consider deploying migrations directly from a local environment to a production environment.
- You have a local CI/CD pipeline
- You are baselining a production environment
This page outlines some examples of how you can do that and why we would generally not recommend it.
Local CI/CD pipeline
Section titled “Local CI/CD pipeline”If you do not have an automated CI/CD process, you can technically deploy new migrations from your local environment to production in the following ways:
- Make sure your migration history is up to date. You can do this through running
prisma migrate dev, which will generate a migration history from the latest changes made. - Swap your local connection URL for your production connection URL
DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/my_local_database"DATABASE_URL="postgresql://johndoe:randompassword@prod-db.example.com:5432/my_production_database"- Run
prisma migrate deploy
⛔ We strongly discourage this solution due to the following reasons
- You risk exposing your production database connection URL to version control.
- You may accidentally use your production connection URL instead and in turn override or delete your production database.
✅ We recommend setting up an automated CI/CD pipeline
The pipeline should handle deployment to staging and production environments, and use migrate deploy in a pipeline step. See the deployment guides for examples.
Baselining a production database
Section titled “Baselining a production database”When you add Prisma Migrate to an existing database, you must baseline the production database. Baselining is performed once, and can be done from a local instance.
Related pages
Section titled “Related pages”Caveats when deploying to AWS platforms: Known caveats when deploying to an AWS platformDeploy Prisma ORM: Learn more about the different deployment paradigms for Node.js applications and how they affect deploying an application using Prisma Client.Deploy to a different OS: Learn how to deploy Node.js and TypeScript applications that are using Prisma Client to a different operating system.Deploying database changes with Prisma Migrate: Learn how to deploy database changes with Prisma Migrate.Edge functions: Learn how to deploy your Prisma ORM-backed apps to edge functions like Cloudflare Workers or Vercel Edge Functions