[Django] #23644: Django 1.7: adding order_by to model Meta class causes Django to create a meaningless migration

3 views
Skip to first unread message

Django

unread,
Oct 13, 2014, 2:26:55 AM10/13/14
to django-...@googlegroups.com
#23644: Django 1.7: adding order_by to model Meta class causes Django to create a
meaningless migration
--------------------------------------+------------------------
Reporter: robvdl | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Keywords: migrations
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------
When you add a Meta class with just an order_by to an existing model,
Django 1.7 thinks it needs to create a migration for this change, while
this does not change the schema at all and probably shouldn't really
require a migration.


South would not create a migration in this case I am pretty sure, it seems
Django 1.7 does.

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

Django

unread,
Oct 13, 2014, 4:31:41 AM10/13/14
to django-...@googlegroups.com
#23644: Django 1.7: adding order_by to model Meta class causes Django to create a
meaningless migration
-------------------------------------+-------------------------------------
Reporter: robvdl | Owner: nobody
Type: | Status: closed
Cleanup/optimization | Version: 1.7
Component: Migrations | Resolution: wontfix
Severity: Normal | Triage Stage:
Keywords: migrations | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by bmispelon):

* status: new => closed
* needs_better_patch: => 0
* resolution: => wontfix
* needs_tests: => 0
* needs_docs: => 0


Comment:

Hi,

This is by design, as noted in the last paragraph of
https://docs.djangoproject.com/en/1.7/topics/migrations/#the-commands:

> Django will make migrations for any change to your models or fields -
even options that don’t affect the database - as the only way it can
reconstruct a field correctly is to have all the changes in the history,
and you might need those options in some data migrations later on (for
example, if you’ve set custom validators).

Thanks.

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

Reply all
Reply to author
Forward
0 new messages