[Solved]-Order in django migrations

17👍

Django tries to create a consistent migration order by first ordering all dependencies in a single migration in alphabetical order, and then using a depth-first search to create the final migration plan. Since the migration plan is always resolved at runtime, a single change may occasionally have a big impact on the final migration plan.

If you need one migration to run after another, adding a dependency is the correct solution. Migrations are designed so that you can write them yourself if the auto-generated migrations don’t suit your needs. How to control the order of migrations is covered by the docs.

👤knbk

Leave a comment