#26223: Squashing migrations with preserve_default=False keeps the default
--------------------------------+------------------------------------
     Reporter:  bartekwojcicki  |                    Owner:  vytisb
         Type:  Bug             |                   Status:  assigned
    Component:  Migrations      |                  Version:  master
     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
--------------------------------+------------------------------------

Comment (by vytisb):

 Here's an alternative approach.

 `AddField.field` could be changed to mean the actual field that goes into
 model state. The transient database default value would be a separate
 attribute on the operation.
 This would make code a bit cleaner because `default` handling would only
 occur in `database_forwards` (where it already occurs).
 For backwards compatibility, constructor would still accept
 `preserve_default` and modify the field if needed.
 `makemigrations` and `squashmigrations` would emit the operation with the
 new signature.
 If `preserve_default` is deprecated, we can suggest users to modify
 existing migrations by hand or simply squash them.

 Same goes for `AlterField`.

 If this approach is worth considering, I could make another PR to see how
 it looks.

--
Ticket URL: <https://code.djangoproject.com/ticket/26223#comment:6>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.bd98c5e24589bf0136916d57e8b8d2e8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to