• 
      

    Don't stash references for models not yet in the database.

    Review Request #12284 — Created May 16, 2022 and submitted

    Information

    Django Evolution
    release-2.x

    Reviewers

    When modifying models that are in the database, we sometimes need to
    stash and restore references (constraints). The code that did this would
    walk through all fields on all models, looking for anything that pointed
    to the model, and would then execute SQL to temporarily remove them or
    to introspect them.

    This was happening even for models that weren't yet added to the
    database, just present in the model registry.

    These are now skipped. Only models that are known to be installed now
    have their refs stashed.

    Encountered this in an upgrade from Review Board 4 -> 5. Verified that
    this solved it.

    Work is still needed to add unit tests here, but that will come later,
    so as not to block current work.

    Summary ID
    Don't stash references for models not yet in the database.
    When modifying models that are in the database, we sometimes need to stash and restore references (constraints). The code that did this would walk through all fields on all models, looking for anything that pointed to the model, and would then execute SQL to temporarily remove them or to introspect them. This was happening even for models that weren't yet added to the database, just present in the model registry. These are now skipped. Only models that are known to be installed now have their refs stashed.
    0ab79bf8f5f515962e030793677db5258f0fe6c8
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-2.x (dea8118)