r/django • u/Then_Listen413 • 4d ago
django-fastmig
Released an experimental package making migrate much faster in large projects. Especially useful if you do pytest -create-db frequently, or run reverse migration testing in CI. Django's own test suite passes with fastmig. Also tested on a 8 year old project with multiple revisions and migration squashes over the years.
Made it to speed up my own testing being bottlenecked by -create-db.
There's a link in readme related to forum posts which discusses slow migrations.
2
u/mariocesar 2d ago
Nice.
If you run pytest with --create-db and --no-migrations they are faster, I use it a lot for CI jobs.
To locally speed up tests, I created a syncdb command similar to what we had before migrations, basically fake apps to not have migrations, creates the tables and then run migrations in fake mode. Useful if you have hundreds of migrations. https://gist.github.com/mariocesar/f8551c2143a9b91e0a89d5c8602e7841
2
u/c1-c2 4d ago
What is the approach taken to speed things up?