Cleaning up Django Migrations
In late 2019 I modernized a large Django 1.11/Python 2 application to use Django 2.2/Python 3. The application included hundreds of database migrations, many of which depended on legacy packages and deprecated functionality that blocked upgrading Django and Python. This post documents how I cleaned up the legacy migrations to unblock upgrading to modern versions of Django and Python. Attempt #1: Squash the migrations The standard way to reduce the number of migrations in Django is called squashing. Squashing generates new migrations that co-exist with the old migrations, which simplifies deploying the changes. ...