Fix a couple of issues in Evolver with partial or model-less evolutions.

Review Request #11245 — Created Oct. 25, 2020 and submitted

Information

Django Evolution
master

Reviewers

Evolver had a couple of issues during app evolution that could break
when evolving only part of a database or evolving an app that doesn't
contain models.

An assumption was made that the database signature would contain an app
signature for every app in the recorded migration list, but this wasn't
guaranteed to be the case. It probably would be in practice, but some
upcoming unit test work triggered a breakage here. We now conditionally
check if the app signature is known before trying to set anything on it.

If an app had evolutions but no models (which could be used for changing
app labels), and that app was new in the signature, then the list of
recorded evolutions would remain blank, causing future issues. Some
logic was nested at the wrong level, making the evolution list dependent
on the model list.

This change fixes both issues.

All unit tests pass.

Summary ID
Fix a couple of issues in Evolver with partial or model-less evolutions.
`Evolver` had a couple of issues during app evolution that could break when evolving only part of a database or evolving an app that doesn't contain models. An assumption was made that the database signature would contain an app signature for every app in the recorded migration list, but this wasn't guaranteed to be the case. It probably would be in practice, but some upcoming unit test work triggered a breakage here. We now conditionally check if the app signature is known before trying to set anything on it. If an app had evolutions but no models (which could be used for changing app labels), and that app was new in the signature, then the list of recorded evolutions would remain blank, causing future issues. Some logic was nested at the wrong level, making the evolution list dependent on the model list. This change fixes both issues.
f40782aef41a20064b1edfd681d7f5c42a0f51ec
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to master (fdf4474)