不要生成不必要的迁移
django-migrations-ignore-attrs的Python项目详细描述
django迁移忽略属性
django migrations ignore attrs是覆盖^{tt1}的包$ 以及用于django的manage.py命令的migrate命令。
django migrations ignore attrs允许避免进行不必要的迁移 对于在数据库架构中没有任何表示的属性。
忽略模型的以下属性:
- 详细名称
- 详细名称复数
标准字段的以下属性将被忽略:
- 选择
- 帮助文本
- 详细名称
忽略ForeignKey的以下属性:
- 相关名称
- 相关查询名称
安装
使用pip或pipenv安装:
pipinstalldjango-migrations-ignore-attrs
将django_migrations_ignore_attrs添加到 settings.py文件:
INSTALLED_APPS=['django_migrations_ignore_attrs',...]
可选配置:
# ignored attributes of modelMIGRATION_IGNORE_MODEL_ATTRS=['verbose_name','verbose_name_plural']# ignored attributes of standard fieldsMIGRATION_IGNORE_FIELD_ATTRS=['choices','help_text','verbose_name']# ignored attributes of ForeignKeyMIGRATION_IGNORE_RELATED_FIELD_ATTRS=['related_name','related_query_name']
命令
生成迁移
为应用程序创建新迁移。
所有选项都与原始的makemigrations命令相同 django应用程序。
迁移
更新数据库架构。管理有迁移的应用程序和没有迁移的应用程序。
所有选项都与来自^{tt9}的原始migrate命令相同$ 应用程序。
许可证
版权所有©2019,Piotr Roszatycki
该软件在GNU Lesser General Public License(LGPL)下分发 3或更大)。