Unmanaged models (managed=False) are now included in
old_model_keys / new_model_keys instead
of being tracked separately. This means unmanaged models will now
generate field-level operations (AddField for FKs,
M2Ms) and other DB-modifying operations that were previously
skipped via the
if not model_state.options.get('managed', True): continue
guard. Django will attempt to create or alter database tables for
models with
managed=False, which is incorrect.
continue at line ~758 explicitly skipped FK/M2M
operations for unmanaged models. With its removal, unmanaged
models flow through the same code path as managed ones — emitting
DDL the ORM has no business emitting.
generate_created_models (and
generate_deleted_models) to skip
FK/M2M/index/constraint operations when
managed=False.