#33586: Cannot delete object (A) referenced by another object (B) if said object
(A) has a foreign key to a custom user.
-------------------------------+------------------------------------
     Reporter:  Jeremy Poulin  |                    Owner:  Bhuvnesh
         Type:  Bug            |                   Status:  assigned
    Component:  Migrations     |                  Version:  4.0
     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 Bhuvnesh):

 These lines were loading {{{apps}}} when the migration is applied
 backward. So instead of popping, simply not loading them inside
 {{{MigrationExecutor._migrate_all_backwards}}} should do the work.

 {{{#!diff
 diff --git a/django/db/migrations/executor.py
 b/django/db/migrations/executor.py
 index eb738cf457..988fb48cd9 100644
 --- a/django/db/migrations/executor.py
 +++ b/django/db/migrations/executor.py
 @@ -200,8 +200,6 @@ class MigrationExecutor:
                  # process.
                  break
              if migration in migrations_to_run:
 -                if "apps" not in state.__dict__:
 -                    state.apps  # Render all -- performance critical
                  # The state before this migration
                  states[migration] = state
                  # The old state keeps as-is, we continue with the new
 state
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33586#comment:12>
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/01070183461266ab-3b25766d-dd54-471e-8065-97d0b363a0ad-000000%40eu-central-1.amazonses.com.

Reply via email to