Repository navigation
Replies: 3 comments 3 replies
|
Honestly the biggest thing for me is never letting Prisma apply a migration I haven't read. I always run And yeah, the rename thing is real. If you rename a field, Prisma doesn't know it's a rename. It just sees one column gone and a new one added, so you get a Enums can bite you too. If you remove a value that some rows still use, the migration fails. A quick Other than that, the SQL gets reviewed in the PR like any other code (I mostly scan for For automated checks, |
|
My preferred workflow would be:
|
|
Hi @RepoRover, thank you for the follow-ups — jumping in on the two questions that I think are still open in this thread. 1. On renames slipping past review as DROP + ADD This is a real trap, and it's documented Prisma behavior rather than a bug: renaming a field in the schema generates a migration that creates the new column and drops the old one (and the data in it). Prisma's own docs say exactly this, and that you have to edit the generated SQL to a single So the failure mode isn't that the reviewer missed something subtle — it's that the generated SQL looks like a normal, intentional change. A 2. On a PR check that runs the migration on an empty database and reports "column X was dropped and re-created" I think this would genuinely help, but with one honest limitation: running the migration on an empty database can never prove data safety by itself, because there is no data to lose. What it can catch is (a) whether the migration applies cleanly, and (b) — if the check diffs the SQL rather than just running it — the DROP + ADD pair on the same table, which is the rename signature. A cheap version of that in CI is The other thing the empty-database run can't catch is what @PratikPaliwal509 already pointed out: a new One caveat on my side: the commands and docs above are the SQL-based flow (Prisma 6/7). I haven't verified how renames are represented in the Prisma 8 Hope that's useful for the tooling you're building — happy to hear whether the DROP + ADD pair check matches what you've seen in real PRs. |
Uh oh!
There was an error while loading. Please reload this page.
I'm trying to understand how teams using Prisma check a migration before it reaches production (
prisma migrate deploy, orprisma db migrateon Prisma ORM 8).migration.sql, ormigration.tsand itsops.jsonon 8), and what do you look for?I'm an engineer working on tooling in this area, and I'd rather learn from what happens in real projects than guess. Thank you.
All reactions