© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
15 replies
sik

What's the best way to deploy migrations on production database?

I'm confused as to what is the best way to deploy migration on the production database.
Locally when I test on my local database instance, I use the commands manually to generate and push the migrations
But I want to automate this.
Say, I'm using Vercel and I want to push the migration on every commit.
In prisma to deploy the generated migrations I use the command
prisma migrate deploy
prisma migrate deploy
, I add this command to the build command like this:
prisma generate && prisma migrate deploy && next build
prisma generate && prisma migrate deploy && next build


There are my scripts in
package.json
package.json

"dev": "vite dev",
"build": "vite build",
.....
"db:start": "supabase start",
"db:stop": "supabase stop --backup",
"db:status": "supabase status",
"db:generate": "drizzle-kit generate:pg",
"db:push": "tsx ./src/lib/server/db/migrate.ts",
"db:migrate": "pnpm db:generate && pnpm db:push",
"db:studio": "drizzle-kit studio --port 3000 --verbose"
"dev": "vite dev",
"build": "vite build",
.....
"db:start": "supabase start",
"db:stop": "supabase stop --backup",
"db:status": "supabase status",
"db:generate": "drizzle-kit generate:pg",
"db:push": "tsx ./src/lib/server/db/migrate.ts",
"db:migrate": "pnpm db:generate && pnpm db:push",
"db:studio": "drizzle-kit studio --port 3000 --verbose"
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

What's the best way to prevent duplicate entries?
Drizzle TeamDTDrizzle Team / help
2y ago
What's the best way to query my db?
Drizzle TeamDTDrizzle Team / help
2y ago
Executing database migrations on Vercel
Drizzle TeamDTDrizzle Team / help
2y ago
What's is the recommended way to do DB migrations, when deploying to vercel?
Drizzle TeamDTDrizzle Team / help
11mo ago