mirror of
https://github.com/django/django.git
synced 2025-10-25 14:46:09 +00:00
Fixed #27200 -- Provided makemigration's allow_migrate() with model_name.
This commit is contained in:
@@ -101,9 +101,12 @@ class Command(BaseCommand):
|
||||
aliases_to_check = connections if settings.DATABASE_ROUTERS else [DEFAULT_DB_ALIAS]
|
||||
for alias in sorted(aliases_to_check):
|
||||
connection = connections[alias]
|
||||
if (connection.settings_dict['ENGINE'] != 'django.db.backends.dummy' and
|
||||
# At least one app must be migrated to the database.
|
||||
any(router.allow_migrate(connection.alias, label) for label in consistency_check_labels)):
|
||||
if (connection.settings_dict['ENGINE'] != 'django.db.backends.dummy' and any(
|
||||
# At least one model must be migrated to the database.
|
||||
router.allow_migrate(connection.alias, app_label, model_name=model._meta.object_name)
|
||||
for app_label in consistency_check_labels
|
||||
for model in apps.get_models(app_label)
|
||||
)):
|
||||
loader.check_consistent_history(connection)
|
||||
|
||||
# Before anything else, see if there's conflicting apps and drop out
|
||||
|
||||
Reference in New Issue
Block a user