#29755 closed Bug (fixed)
Infinite migrations created after removing Meta.default_related_name
Reported by: | Aamir Rind | Owned by: | Simon Charette |
---|---|---|---|
Component: | Migrations | Version: | 1.11 |
Severity: | Normal | Keywords: | migrations, unlimited, infinite, makemigrations |
Cc: | aamir.adnan.rind@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Consider there exists following models:
from django.db import models class Parent(models.Model): name = models.CharField(max_length=50) class Child(models.Model): parent = models.ForeignKey('polls.Parent') class Meta: default_related_name = 'children' ordering = ('id', )
- Run
makemigrations
command this will create0001_initial.py
migration. - Now go to
models.py
and removedefault_related_name
fromChild
model. - Run
makemigrations
multiple times and it will create same migration again and again.
I have created a project to reproduce this issue: https://github.com/intellisense/django-infinite-migrations
Change History (5)
comment:1 by , 6 years ago
Component: | Core (Management commands) → Migrations |
---|---|
Summary: | Infinite Django Migrations → Infinite migrations created after removing Meta.default_related_name |
Triage Stage: | Unreviewed → Accepted |
Version: | 2.1 → 1.11 |
comment:2 by , 6 years ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
It was a simple matter of adding the option to AlterModelOptions.ALTER_OPTION_KEYS
Note:
See TracTickets
for help on using tickets.
Bug report seems to be against Django 1.11 but I verified that it affects master as of today (1b1f64ee5a78cc217fead52cbae23114502cf564).