• 
      

    Don't emit migrations signals if there's no migration plan.

    Review Request #14746 — Created Dec. 23, 2025 and submitted

    Information

    Django Evolution
    master

    Reviewers

    An updated signal handler for the pre/post migrations signals inside
    Django was assuming that the plan argument was not None, and was
    crashing when we would emit those signals.

    This change moves those signal emissions inside the nearby conditionals
    so we only emit them if we're actually doing anything with migrations.

    This also sets a default value for full_migration_plan so that static
    checkers don't warn about it possibly being unbound.

    Ran unit tests without causing a crash deep inside Django.

    Summary ID
    Don't emit migrations signals if there's no migration plan.
    An updated signal handler for the pre/post migrations signals inside Django was assuming that the `plan` argument was not None, and was crashing when we would emit those signals. This change moves those signal emissions inside the nearby conditionals so we only emit them if we're actually doing anything with migrations. This also sets a default value for `full_migration_plan` so that static checkers don't warn about it possibly being unbound. Testing Done: Ran unit tests without causing a crash deep inside Django.
    muvptuyptkulyuuokussrrwumxpkwyrl
    Description From Last Updated

    I think this is correct now that we're dropping syncdb-supporting Django versions, but it wouldn't have been for those. It …

    chipx86chipx86
    chipx86
    1. 
        
    2. Show all issues

      I think this is correct now that we're dropping syncdb-supporting Django versions, but it wouldn't have been for those. It might be worth adding a note in the comments calling these stating that these used to be called unconditionally but are now only called if we now we're migrating and therefore have a plan. I think otherwise the rationale for this change can get lost over time as code is moved around, and it might be notable.

    3. 
        
    david
    chipx86
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to master (80a7490)