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
, I add this command to the build command like this: prisma generate && prisma migrate deploy && next build

There are my scripts in
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"
Was this page helpful?