-
-
Notifications
You must be signed in to change notification settings - Fork 33
Add missing documentation on how to resolve migration conflicts in Github and Django #442
Copy link
Copy link
Open
Labels
PII: FALSETable or function does not have or use Personally Identifiable Information (PII)Table or function does not have or use Personally Identifiable Information (PII)complexity: smallSmall changes with all steps laid out in detailSmall changes with all steps laid out in detailfeature: docs: PD team documentationdocumentation on PD team processes and architecture, etc.documentation on PD team processes and architecture, etc.good first issueGood for newcomersGood for newcomersrole: back endrole: devs: PD teamstakeholder: People Depot Teamstakeholder: People Depot Teamsize: 0.25ptCan be done in 1.5 hours or lessCan be done in 1.5 hours or less
Milestone
Metadata
Metadata
Assignees
Labels
PII: FALSETable or function does not have or use Personally Identifiable Information (PII)Table or function does not have or use Personally Identifiable Information (PII)complexity: smallSmall changes with all steps laid out in detailSmall changes with all steps laid out in detailfeature: docs: PD team documentationdocumentation on PD team processes and architecture, etc.documentation on PD team processes and architecture, etc.good first issueGood for newcomersGood for newcomersrole: back endrole: devs: PD teamstakeholder: People Depot Teamstakeholder: People Depot Teamsize: 0.25ptCan be done in 1.5 hours or lessCan be done in 1.5 hours or less
Type
Projects
Status
📋Prioritized Backlog
Overview
We need to add documentation, so that developers know how to resolve migration conflicts. For example, let's say you're rebasing and the
max_migration.txtfile shows a conflict. That's a sign that the numbered migration files are conflicting as well (because they're named differently, their conflicts don't show up in git).Action Items
Resources/Instructions/Tags
Documentation Addition Notes
What's missing?
In many cases, you can resolve migration conflicts by using the
rebase_migrationcommand provided bydjango-linear-migrations.We're assuming you're at your branch and all migrations are applied.
Run this to rebase your branch to
main:note: for people that have rerere enabled, you can temporarily disable it by passing in this option:
git -c rerere.enabled=false rebase ...Now see if there's a conflict in
core/migrations/max_migration.txtand note the lowest migration number. We're going to use this later.If
core/migrations/max_migration.txtdoes show a conflict (e.g., betweencore/0025andcore/0027), you'll need to undo the rebase. Run this:If previous migrations are part of the conflict, you'll need to roll the local database back to a point before them, so you can change those migrations if necessary. Run this to roll the database back to an earlier migration, before any of the migrations that are in conflict (replacing '0024' with the appropriate number):
Now re-run the rebase:
git rebase upstream/main # see conflicts returnedResolve code conflicts if any. (In case there's other conflicts besides the migrations)
Resolve the migration conflict:
docker-compose exec web python manage.py rebase_migration coreRun all the migrations again to make sure the new ones apply cleanly:
Stage all the fixes:
Run pre-commit checks:
Finally, continue rebase:
Where should it go?
When would this information have been useful?
upstream/mainWhich roles will benefit most from this information?