Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to optimize migrations in Django 1.8

I'm using Django 1.8 and have an app with over 100 files in the migration folder. Is there a way in Django without deleting the files to "compress" or "optimise" these migrations so I don't have so many of them?

like image 288
Prometheus Avatar asked Dec 20 '22 01:12

Prometheus


1 Answers

Have you read this part from the django docs?

Squashing migrations¶

You are encouraged to make migrations freely and not worry about how many you have; the migration code is optimized to deal with hundreds at a time without much slowdown. However, eventually you will want to move back from having several hundred migrations to just a few, and that’s where squashing comes in.

Source: https://docs.djangoproject.com/en/1.8/topics/migrations/

like image 152
het.oosten Avatar answered Dec 24 '22 02:12

het.oosten