Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding missing documentation on how to resolve migration conflicts #424

Open
3 of 14 tasks
shmonks opened this issue Oct 24, 2024 · 2 comments
Open
3 of 14 tasks

Adding missing documentation on how to resolve migration conflicts #424

shmonks opened this issue Oct 24, 2024 · 2 comments
Labels
complexity: small All steps are laid out in detail so that someone new to the project can work on it dependency Issue has dependencies feature: docs: PD team documentation documentation on PD team processes and architecture, etc. ready for dev lead ready for product role: back end role: dev role: product s: PD team stakeholder: People Depot Team size: 0.25pt Can be done in 0.5-1.5 hours
Milestone

Comments

@shmonks
Copy link
Member

shmonks commented Oct 24, 2024

Dependency

  • Information missing on how to resolve migration conflicts in GitHub and/or Django

Overview

We need to make it easy to:

  • Record any missing documentation on how to resolve migration conflicts
  • Keep those records in one place
  • Create new issues based on those records

This issue is the place to record missing documentation and start creating related new issues.

Details

  • We are striving to write documentation that helps developers use GitHub and Django.
  • This issue tracks the documentation that needs to be added on how to resolve migration conflicts in GitHub and Django. If you've noticed missing documentation about other Git and/or Django processes,
see the following issues instead

Action Items

  • For each piece of missing information, copy and paste the following template into a new comment below.
### Overview
We need to add [REPLACE WITH WHAT NEEDS ADDING], so that developers can [REPLACE WITH BENEFIT]

### Action Items
- [ ] [REPLACE WITH ACTION ITEMS]

### Resources/Instructions/Tags 

- 1.0x [REPLACE WITH LINKS TO ANY EXTERNAL DOCS THAT MIGHT BE USEFUL (WITH INSTRUCTIONS, IF NEEDED)]
- 1.0x [REPLACE WITH ANY RELEVANT TAGS e.g., git, django, etc.]

### Documentation Addition Notes
#### What's missing?
[REPLACE WITH DESCRIPTION OF WHAT'S MISSING FROM THE DOCUMENTATION]
   
#### Where should it go?
[REPLACE WITH URL OR INDICATE NEW PAGE AND PARENT PAGE]

####  When would this information have been useful?
[REPLACE WITH LINK TO THE PR/ISSUE/SITUATION THAT PROMPTED THE NEED FOR THIS CHANGE/ADDITION]
   
#### Which roles will benefit most from this information?
[REPLACE WITH ROLES]

  • Fill out as many of the template's fields as possible.
  • Copy and paste a link to your comment in Section 2: List of comments/issues about missing documentation on resolving migration conflicts below, using the next available number
  • Copy the content of your comment
  • Create a new issue, pasting the content of your comment into the new issue
  • Add the following labels to the new issue
    • feature: docs: PD team documentation
    • size: 0.25pt
    • s: PD team
    • ready for dev lead
    • choose a complexity label that fits
    • choose the role label that fits
  • When this new issue has been created, add a link to it in Section 2: List of comments/issues about missing documentation on resolving migration conflicts below. Make sure the link to your new issue appears beneath the link to your comment, so we can ensure that all comments get made into issues
  • Hide the original comment (you can mark it 'Resolved')

Section 2: List of comments/issues about missing documentation on resolving migration conflicts

@github-project-automation github-project-automation bot moved this to 🆕New Issue Review in P: PD: Project Board Oct 24, 2024
@shmonks shmonks self-assigned this Oct 24, 2024
@shmonks shmonks changed the title Adding missing documentation on how to resolve migration conflicts in GitHub Adding missing documentation on how to resolve migration conflicts in GitHub and Django Oct 24, 2024
@shmonks shmonks added good first issue Good for newcomers role: back end s: PD team stakeholder: People Depot Team draft This issue is not fully-written size: 0.25pt Can be done in 0.5-1.5 hours feature: docs: PD team documentation documentation on PD team processes and architecture, etc. ready for dev lead complexity: small All steps are laid out in detail so that someone new to the project can work on it role: dev and removed role: missing size: missing feature: missing stakeholder: missing milestone: missing complexity: missing labels Oct 24, 2024
@shmonks shmonks added this to the w. Ongoing milestone Oct 24, 2024
@shmonks shmonks removed their assignment Oct 24, 2024
@shmonks

This comment was marked as outdated.

@shmonks shmonks added dependency Issue has dependencies and removed draft This issue is not fully-written good first issue Good for newcomers labels Oct 24, 2024
@shmonks shmonks moved this from 🆕New Issue Review to 🧊Ice Box in P: PD: Project Board Oct 25, 2024
@shmonks shmonks self-assigned this Oct 28, 2024
@shmonks shmonks added the draft This issue is not fully-written label Oct 28, 2024
@shmonks shmonks moved this from 🧊Ice Box to 🏗In progress-actively working in P: PD: Project Board Oct 28, 2024
@shmonks shmonks removed their assignment Oct 31, 2024
@shmonks shmonks removed the draft This issue is not fully-written label Oct 31, 2024
@shmonks shmonks moved this from 🏗In progress-actively working to 📋Prioritized Backlog in P: PD: Project Board Oct 31, 2024
@shmonks
Copy link
Member Author

shmonks commented Oct 31, 2024

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.txt file 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

  • 1.01 git, django

Documentation Addition Notes

What's missing?

In many cases, you can resolve migration conflicts by using the rebase_migration command provided by django-linear-migrations.

  1. We're assuming you're at your branch and all migrations are applied.

  2. Run this to rebase your branch to main:

    git rebase upstream/main

    note: for people that have rerere enabled, you can temporarily disable it by passing in this option: git -c rerere.enabled=false rebase ...

  3. Now see if there's a conflict in core/migrations/max_migration.txt and note the lowest migration number. We're going to use this later.

  4. If core/migrations/max_migration.txt does show a conflict (e.g., between core/0025 and core/0027), you'll need to undo the rebase. Run this:

    git rebase --abort
  5. 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):

    ./scripts/migrate.sh core 0024
  6. Now re-run the rebase:

    git rebase upstream/main
    # see conflicts returned
  7. Resolve code conflicts if any. (In case there's other conflicts besides the migrations)

  8. Resolve the migration conflict:

    docker-compose exec web python manage.py rebase_migration core
  9. Run all the migrations again to make sure the new ones apply cleanly:

    ./scripts/migrate.sh core
  10. Stage all the fixes:

    git add <max_migration.txt> <changed migration files> <fixed code files if any>
  11. Run pre-commit checks:

    pre-commit run
  12. Finally, continue rebase:

    git rebase --continue

Where should it go?

[REPLACE WITH URL OR INDICATE NEW PAGE AND PARENT PAGE]

When would this information have been useful?

Which roles will benefit most from this information?

  • Backend/Dev

@vanessaavviles vanessaavviles self-assigned this Oct 31, 2024
@vanessaavviles vanessaavviles moved this from 📋Prioritized Backlog to 🏗In progress-actively working in P: PD: Project Board Oct 31, 2024
@shmonks shmonks moved this from 🏗In progress-actively working to 🧊Ice Box in P: PD: Project Board Nov 14, 2024
@fyliu fyliu changed the title Adding missing documentation on how to resolve migration conflicts in GitHub and Django Adding missing documentation on how to resolve migration conflicts Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: small All steps are laid out in detail so that someone new to the project can work on it dependency Issue has dependencies feature: docs: PD team documentation documentation on PD team processes and architecture, etc. ready for dev lead ready for product role: back end role: dev role: product s: PD team stakeholder: People Depot Team size: 0.25pt Can be done in 0.5-1.5 hours
Projects
Status: 🧊Ice Box
Development

No branches or pull requests

2 participants