Opened 10 years ago

Closed 10 years ago

#23644 closed Cleanup/optimization (wontfix)

Django 1.7: adding order_by to model Meta class causes Django to create a meaningless migration

Reported by: Rob van der Linde Owned by: nobody
Component: Migrations Version: 1.7
Severity: Normal Keywords: migrations
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (1)

comment:1 by Baptiste Mispelon, 10 years ago

Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top