4 ms·
My biggest issue with django right now is the speed of the migrations since 1.7. At work, we have a project with around 30 apps and 170 interrelated migrations
by jeffasinger 11y ago
My biggest issue with django right now is the speed of the migrations since 1.7.
At work, we have a project with around 30 apps and 170 interrelated migrations. It takes 2-3 minutes to run all the migrations, which have to happen at the beginning of many runs of our test suite.
- brento 11y agoThere are ways to "turn off" migrations [1] for testing. Also you can squash [2] your migrations which should help. [1] http://stackoverflow.com/a/28560805/176611 http://stackoverflow.com/a/28560805/176611 [2] https://docs.djangoproject.com/en/1.8/topics/migrations/#squashing-migrations https://docs.djangoproject.com/en/1.8/topics/migrations/#squ...
- jeffasinger 11y agoUnfortunately squashing doesn't help as much as I'd hoped as the performance problem is in the loader (executing migrations is pretty quick). It can also get tricky with interdependencies between apps. Turning off migrations is great in the cases it works, but it doesn't provide an easy way to also run the few data migrations that some parts of our code rely on. Obviously we could probably fix this in some non-DRY way, but I'd rather not. The situation as is, is workable, but it would be way better to improve the performance of this a little (which I have a feeling is definitely possible). When I next get some time to work on this, I'll give it a crack.
- jsmeaton 11y agoThere have been lots of performance improvements added since migrations officially landed, but I'm still hearing it's a concern for bigger projects. More eyes will definitely help. For your testing, perhaps you might want to consider the `--keepdb` switch. Not very helpful when you're changing your models though.
- crdoconnor 11y agoWhy not cache the database post migration?