When you rebase your development branch off of
a newer copy of master, and your branch contains
new database migrations, you can occasionally get
thrown off by conflicting migrations that are
new in master.

To help you understand how to deal with these
conflicts, I am about to narrate an exercise
where I bring my development branch called
showell-topic up to date with master.

Note: You can also use the command ./tools/renumber-migrations to
automatically perform migration renumbering.

In this example,
there is a migration on master called
0024_realm_allow_message_editing.py, and
that was the most recent migration at the
time I started working on my branch. In
my branch I created migrations 0025 and 0026,
but then meanwhile on master somebody else
created their own migration 0025.

Anyway, on with the details…

First, I go to showell-topic and run tests to
make sure that I’m starting with a clean, albeit
out-of-date, dev branch:

You may want to make note of your HEAD commit on your branch
before you start rebasing, in case you need to start over, or
do like I do and rely on being able to find it via github. I’m
not showing the details of that, since people have different
styles for managing botched rebases.

The above traceback is fairly noisy, but it’s pretty apparent that
I have migrations that are out of order. More precisely, my 0025 migration
points to 0024 as its dependency, where it really should point to the
other 0025 as its dependency, and I need to renumber my migrations to
0026 and 0027.

I will now start the process of renaming 0025_add_topic_table.py to
be 0026_add_topic_table.py and having it depend on
0025_realm_message_content_edit_limit. Before I start, I want to
know which of my commits created my 0025 migration: