#23822: Serialize model managers in migrations
-----------------------------+------------------------------------
     Reporter:  MarkusH      |                    Owner:  MarkusH
         Type:  New feature  |                   Status:  new
    Component:  Migrations   |                  Version:  master
     Severity:  Normal       |               Resolution:
     Keywords:               |             Triage Stage:  Accepted
    Has patch:  0            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  0            |                    UI/UX:  0
-----------------------------+------------------------------------

Comment (by carljm):

 I had the same concern as Shai with this ticket. Anything that is imported
 in migration files adopts some new, rather stringent, backwards-
 compatibility requirements. It can never move, go away, or change in
 backwards-incompatible ways, as long as the migration(s) referencing it
 are still around. And getting rid of old migrations is not easy,
 especially for reusable third-party projects (see the lengthy discussion
 over on #23861).

 But I can also see some cases where a simple custom manager is fundamental
 to a model's behavior, and less likely to change. (For one example, I
 think of custom managers I've implemented in the past for soft-delete). I
 can certainly see the attractiveness of automatically having this manager
 in migrations as well.

 One option would be to make this behavior available, but opt-in via
 something like a `use_in_migrations = True` attribute on the manager,
 roughly parallel to the existing `use_for_related_fields`. That way we
 wouldn't be forcing anyone into these new back-compat restrictions on
 custom managers, but for those who understand the tradeoff (the downsides
 should be well documented) and want to make it, they have that choice.

 I like this idea, although I still wonder whether even having that option
 is a bad temptation to have lying around -- something that'll be awfully
 tempting in the moment, but you may regret it in the morning :-)

--
Ticket URL: <https://code.djangoproject.com/ticket/23822#comment:4>
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/065.05b12c216cba41fe6329d10169eaebab%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to