3đź‘Ť
What flattening migrations means is basically just chunking all of the migrations together as to reduce runtime of the migrations when migrations grow fairly large.
It’s possible but not recommended since you’ll be losing all of your migration history effectively making each and every migration you run start from 0.
I haven’t read anywhere that flattening is “recommended” so I can’t give you that piece of advice, if you have a link I’d be happy to read it.
I have read that Ruby on Rails have this functionality but it isn’t recommended there either.
Consider these questions first:
- Is this something that you really want? You would lose all history.
- It would lead to migration down to version 0 and then back up again,
this would be done often
If this is done to hinder any missing or out of order migrations I would use
python manage.py schemamigration myapp --merge
or last but not least update the latest migration using --update
I found this question whilst googling and thought it’d be good for reference, it in turn contains links to 4 other questions.