#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
makemigrationscommand this will create0001_initial.pymigration. - Now go to
models.pyand removedefault_related_namefromChildmodel. - Run
makemigrationsmultiple 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 , 7 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 , 7 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).