BlenderScript Academy

Master Blender Python automation and learn how to run Prisma migrations without downtime. Hands-on coaching for developers who want to ship...
Olongapo City, PH
Created byProfile picturelightlayout8f
2 joined
Profile picture
@lightlayout8fProfile pictureJun 5

How to Run Prisma Migrations Without Downtime (Expand-and-Contract Pattern)

Most teams ship Prisma migrations the dangerous way — they run prisma migrate deploy, cross their fingers, and hope nothing breaks. If you're renaming a column, changing a type, or splitting a table, your production app can throw errors mid-deploy.


There's a better way: the expand-and-contract pattern.


The Problem


When you rename a column from username to display_name, Prisma generates a migration that drops the old column and creates a new one. During deployment, any running application code still referencing username will fail.


The Fix: Expand, Migrate, Contract


Step 1 — Expand: Add the new column display_name alongside the old username column. Deploy this migration. Your app still reads from username, so nothing breaks.


Step 2 — Backfill: Copy data from username into display_name. Use a script or a database trigger to keep them in sync during the transition.


Step 3 — Switch: Deploy your application code to read/write from display_name instead of username.


Step 4 — Contract: Once all code references display_name and the backfill is verified, drop the old username column in a final migration.


Why This Works


Each step is independently deployable and reversible. At no point does old code break because of a new schema, and at no point does new code depend on a column that doesn't exist yet.


Key Rule


Never drop a column in the same migration that adds its replacement. Separate the expand and contract into distinct deploys with a code change in between.


This is one of the core patterns I teach in my full course — including shadow databases, safe rollbacks, CI/CD integration, and automating pipelines with Blender Python scripts.

Profile picture
@lightlayout8fProfile pictureJun 5
Pinned post

🚀 Welcome to BlenderScript Academy — Start Here

Welcome to the community. Here's how to get the most out of your membership:


1. Start the course immediately. The modules are sequential — each one builds on the last. Don't skip ahead.


2. Set up your environment first. Module 1, Lesson 1 walks you through installing Blender, Node.js, Prisma CLI, and your code editor. Do this before anything else.


3. Use the community chat. Post questions, share your progress, and help others. The best learners here are the ones who ship publicly.


4. Bookmark the capstone brief. Module 5 is a full-stack project that ties everything together. Skim it early so you know where you're headed.


5. Check back here for updates. I'll post new resources, bonus tutorials, and workflow tips in this feed.


Let's build. 💪