How to Automatically Migrate Database on Vercel Deployment?
Answered
American black bear posted this in #help-forum

American black bearOP
I’m using Next.js hosted on Vercel for production and running locally for development. My PostgreSQL database is hosted on NeonDB for production and in a local Docker container for dev. I’m also using DrizzleORM for ORM and Drizzle Kit for migrations.
I want to automatically run database migrations when deploying to Vercel, similar to a pre-build hook.
Is this possible to do?
I want to automatically run database migrations when deploying to Vercel, similar to a pre-build hook.
Is this possible to do?
Answered by Yi Lon Ma
just update the
build
or start
script of your application to run the migrations first and then the actual command after