Changes between Initial Version and Version 1 of Ticket #33586, comment 16
- Timestamp:
- Sep 24, 2022, 12:59:51 AM (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #33586, comment 16
initial v1 7 7 }}} 8 8 9 one thing we can do is re-creating the appsinside {{{database_backwards}}} for RunPython Operation. This should also not affect the performance much.9 one thing we can do is clear apps cache inside {{{database_backwards}}} for RunPython Operation. This should also not affect the performance much. 10 10 {{{ #!patch 11 11 diff --git a/django/db/migrations/operations/special.py b/django/db/migrations/operations/special.py 12 index 94a6ec72de.. 835f2c701710064412 index 94a6ec72de..6acdfb6cb3 100644 13 13 --- a/django/db/migrations/operations/special.py 14 14 +++ b/django/db/migrations/operations/special.py … … 17 17 18 18 def database_backwards(self, app_label, schema_editor, from_state, to_state): 19 + from_state. __dict__.pop('apps', None)19 + from_state.clear_delayed_apps_cache() 20 20 if self.reverse_code is None: 21 21 raise NotImplementedError("You cannot reverse this operation") 22 22 if router.allow_migrate( 23 23 24 }}} 24 we could've done the same thing inside {{{RunPython.state_forwards}}} but since reloading apps is not required for forward migrations, we can save some time there. 25 25 26 26 27 Ps: Passing all tests.