#27666: Delay rendering of models in migration operations when possible
-------------------------------------+-------------------------------------
     Reporter:  Markus Holtermann    |                    Owner:  Markus
         Type:                       |  Holtermann
  Cleanup/optimization               |                   Status:  assigned
    Component:  Migrations           |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  1
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Markus Holtermann:

Old description:

> As it turns out, when we delay the rendering of related models up to the
> point where it's necessary (just before RunPython, afaict), we can cut
> down migration time to a quarter and maybe more:
> https://github.com/MarkusH/django/commit/6b8280e0582d778944585e966404252c4994185e#commitcomment-19719252
>
> PR: https://github.com/django/django/pull/7589
>
> Given that 3rd party migration operations may need to enforce model
> rendering like we do for RunPython, we probably need to tread this as a
> backwards incompatible change, I suppose.
>
> {{{#!python
>     def database_forwards(self, app_label, schema_editor, from_state,
> to_state):
>         if from_state.is_delayed and 'apps' in from_state.__dict__:
>             del from_state.__dict__['apps']
>         # ...
> }}}

New description:

 As it turns out, when we delay the rendering of related models up to the
 point where it's necessary (just before RunPython, afaict), we can cut
 down migration time to a quarter and maybe more:
 
https://github.com/MarkusH/django/commit/6b8280e0582d778944585e966404252c4994185e#commitcomment-19719252

 PR: https://github.com/django/django/pull/7589

 Given that 3rd party migration operations may need to enforce model
 rendering like we do for RunPython, we probably need to treat this as a
 backwards incompatible change, I suppose.

 {{{#!python
     def database_forwards(self, app_label, schema_editor, from_state,
 to_state):
         if from_state.is_delayed and 'apps' in from_state.__dict__:
             del from_state.__dict__['apps']
         # ...
 }}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27666#comment:3>
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.6ca837fbc6451e167400e26ca4b4db85%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to