diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py index 6037c37df59..833c81d31bb 100644 --- a/django/db/migrations/autodetector.py +++ b/django/db/migrations/autodetector.py @@ -233,6 +233,9 @@ class MigrationAutodetector(object): field=field, ) ) + swappable_setting = new_apps.get_model(app_label, model_name)._meta.get_field_by_name(field_name)[0].swappable_setting + if swappable_setting is not None: + self.add_swappable_dependency(app_label, swappable_setting) # Old fields for app_label, model_name, field_name in old_fields - new_fields: old_model_state = self.from_state.models[app_label, model_name]