#32206: Incorrect migration generated if field has been renamed when it has
verbose_name set
-------------------------------------+-------------------------------------
     Reporter:  Peter Inglesby       |                    Owner:  Hasan
         Type:                       |  Ramezani
  Cleanup/optimization               |                   Status:  assigned
    Component:  Migrations           |                  Version:  3.1
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

 * type:  Bug => Cleanup/optimization


Comment:

 Replying to [comment:3 Simon Charette]:
 > It feels like it's more of an optimization than a bug though as this
 behaviour is due to the initial design decision that the migration
 framework should not hold an allow list of attributes that affect database
 state or not. The same ''problem'' is present when altering `validators`
 for example.

 Yes it's not a bug, maybe a cleanup, but I'm not sure about changing the
 current behavior. There are multiple attributes that don't affect database
 state, see
 
[https://github.com/django/django/blob/9f72b0970db4be76d14bd7be5a21582d2cc484bc/django/db/backends/base/schema.py#L1061-L1088
 BaseDatabaseSchemaEditor._field_should_be_altered()], but we cannot
 guarantee this for 3rd-party backends. I would close this as wontfix and
 keep the current flow, so if you want to rename a field and change its
 non-database attributes you need to do this in two steps:
 - rename field (`RenameField`),
 - change attributes (`AlterField`, which is a noop operation for such
 attributes, see #25253 and #31826).

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.bbef5b3d8edaca36fb9c83d4d90e921b%40djangoproject.com.

Reply via email to