如何在 Django 1.8 中优化迁移

How to optimize migrations in Django 1.8

我使用的是 Django 1.8,并且有一个应用程序在迁移文件夹中包含 100 多个文件。在 Django 中有没有办法不删除 "compress" 或 "optimise" 这些迁移的文件,所以我没有那么多?

您是否从 django 文档中阅读了这一部分?

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.

来源:https://docs.djangoproject.com/en/1.8/topics/migrations/