About This Talk
Django migrations are a great tool for keeping track of changes you made to your models over time. After years of changes in a project they can become very numerous and you may notice that it takes a long time to create the test database.
squashmigrations
can help you reduce an existing set of many migrations down to one (or sometimes a few), which still represent the same changes.
However it has some limitations, and it could work in a way you don’t need.
Let’s inspect this command and the alternative of creating migrations “from scratch” in an existing project for improving your tests speed.
- inspecting django migration commands
makemigrations
migrate
showmigrations
sqlmigrate
- creating a sample project with multiple migrations
- analyzing test performances
- inspecting the
squashmigrations
command - squashing migrations in the sample project and comparing performances
- not enough? Let’s try an “exotic/drastic” way to squash our migrations
- comparing performances of the “exotic/drastic” solution
The key point of this talk is to speed up django testing in projects with many migrations
Presenters
Denny Biasiolli (he/him)
Developer for many years, I enjoy contributing to open source projects and I love long and exhausting sports, like triathlon, mountain running and software development :)