[Django] #29755: Infinite Django Migrations

6 views
Skip to first unread message

Django

unread,
Sep 13, 2018, 6:50:41 PM9/13/18
to django-...@googlegroups.com
#29755: Infinite Django Migrations
-------------------------------------+-------------------------------------
Reporter: Aamir | Owner: nobody
Rind |
Type: Bug | Status: new
Component: Core | Version: 2.1
(Management commands) | Keywords:
Severity: Normal | migrations,unlimited,infinite,makemigrations
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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 create `0001_initial.py`
migration.
- Now go to `models.py` and remove `default_related_name` from `Child`
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

--
Ticket URL: <https://code.djangoproject.com/ticket/29755>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 13, 2018, 8:52:41 PM9/13/18
to django-...@googlegroups.com
#29755: Infinite migrations created after removing Meta.default_related_name
-------------------------------------+-------------------------------------
Reporter: Aamir Rind | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
migrations,unlimited,infinite,makemigrations|
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* component: Core (Management commands) => Migrations
* version: 2.1 => 1.11
* stage: Unreviewed => Accepted


Comment:

Bug report seems to be against Django 1.11 but I verified that it affects
master as of today (1b1f64ee5a78cc217fead52cbae23114502cf564).

--
Ticket URL: <https://code.djangoproject.com/ticket/29755#comment:1>

Django

unread,
Sep 13, 2018, 11:35:28 PM9/13/18
to django-...@googlegroups.com
#29755: Infinite migrations created after removing Meta.default_related_name
-------------------------------------+-------------------------------------
Reporter: Aamir Rind | Owner: Simon
| Charette
Type: Bug | Status: assigned

Component: Migrations | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
migrations,unlimited,infinite,makemigrations|
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

* owner: nobody => Simon Charette
* status: new => assigned
* has_patch: 0 => 1


Comment:

It was a simple matter of adding the option to
`AlterModelOptions.ALTER_OPTION_KEYS`

https://github.com/django/django/pull/10389

--
Ticket URL: <https://code.djangoproject.com/ticket/29755#comment:2>

Django

unread,
Sep 14, 2018, 3:00:45 AM9/14/18
to django-...@googlegroups.com
#29755: Infinite migrations created after removing Meta.default_related_name
-------------------------------------+-------------------------------------
Reporter: Aamir Rind | Owner: Simon
| Charette
Type: Bug | Status: assigned
Component: Migrations | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
migrations,unlimited,infinite,makemigrations| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Accepted => Ready for checkin


Comment:

Yep. Looks good.

--
Ticket URL: <https://code.djangoproject.com/ticket/29755#comment:3>

Django

unread,
Sep 14, 2018, 10:26:10 AM9/14/18
to django-...@googlegroups.com
#29755: Infinite migrations created after removing Meta.default_related_name
-------------------------------------+-------------------------------------
Reporter: Aamir Rind | Owner: Simon
| Charette
Type: Bug | Status: closed
Component: Migrations | Version: 1.11
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
migrations,unlimited,infinite,makemigrations| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"a4495f4b989dc919d80fcf9f38e31e247faa94fb" a4495f4b]:
{{{
#!CommitTicketReference repository=""
revision="a4495f4b989dc919d80fcf9f38e31e247faa94fb"
Fixed #29755 -- Made migrations detect changes to
Meta.default_related_name.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29755#comment:4>

Django

unread,
Sep 14, 2018, 10:26:11 AM9/14/18
to django-...@googlegroups.com
#29755: Infinite migrations created after removing Meta.default_related_name
-------------------------------------+-------------------------------------
Reporter: Aamir Rind | Owner: Simon
| Charette
Type: Bug | Status: closed
Component: Migrations | Version: 1.11
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
migrations,unlimited,infinite,makemigrations| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"4c5a8c6f50577daa8b8aaef28a8f32ab34185e80" 4c5a8c6]:
{{{
#!CommitTicketReference repository=""
revision="4c5a8c6f50577daa8b8aaef28a8f32ab34185e80"
[2.1.x] Fixed #29755 -- Made migrations detect changes to
Meta.default_related_name.

Backport of a4495f4b989dc919d80fcf9f38e31e247faa94fb from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29755#comment:5>

Reply all
Reply to author
Forward
0 new messages