-
|
Hello! Sometimes team members will modify the DB schema on separate branches, resulting in conflicting |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 7 replies
-
|
imo simplest way is create migration file in merge CI btw there are so many possibilities with migration merge conflicts, customize it for your team environment |
Beta Was this translation helpful? Give feedback.
-
|
@lxia1220 is right that there are many possible solutions, but for those who find this on Google, here's a manual fix I often perform: Situation: You merge Conflict: Typical Solution: Regenerate your migrations Steps:
|
Beta Was this translation helpful? Give feedback.
-
|
Currently my process to solve this:
Depending on your team size and PR frequency, you might have to do this multiple times. |
Beta Was this translation helpful? Give feedback.
-
|
This is a missing feature - #2488 - I'll cross post an interim solution here, which automates the suggestions in the above comments: It's a little script written by gburtini - github gist if you run it with FORCE_FIX=true:
if you run it with FORCE_FIX=false (the default behavior):
You do have to be sure to modify line 9 and line 133 to match your particular setup |
Beta Was this translation helpful? Give feedback.
-
|
lol in Django we just add |
Beta Was this translation helpful? Give feedback.
-
|
I ran into the same issue, and with my team we decided to use the parent branch as source of truth, and to re-generate the migration before merging. It's clean and predictible. I made a discussion about this approach here : #5581 and here is the resume of the discussion linked : The solution: always regenerate on top of the parentWhen finishing a feature branch, don't push your Step 1 — Pull the parent branch and resolve schema conflicts git pull origin dev
# resolve conflicts in schema.tsStep 2 — Discard your drizzle/, restore the parent's git checkout origin/dev -- drizzle/The parent's Step 3 — Regenerate cleanly on top of the parent pnpm db:generate
pnpm db:migrate # verify locally
git add drizzle/ This produces a single clean migration on top of the parent's history — no snapshot conflicts, no stale state. |
Beta Was this translation helpful? Give feedback.
imo simplest way is create migration file in merge CI
https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue#managing-a-merge-queue
btw there are so many possibilities with migration merge conflicts, customize it for your team environment