mirror of
https://github.com/django/django.git
synced 2025-10-28 08:06:09 +00:00
Fixed #25855 -- Enhanced the migration warning for runserver.
Added unapplied migration count and the list of unmigrated apps.
This commit is contained in:
@@ -172,9 +172,17 @@ class Command(BaseCommand):
|
||||
|
||||
plan = executor.migration_plan(executor.loader.graph.leaf_nodes())
|
||||
if plan:
|
||||
self.stdout.write(self.style.NOTICE(
|
||||
"\nYou have unapplied migrations; your app may not work properly until they are applied."
|
||||
))
|
||||
apps_waiting_migration = sorted(set(migration.app_label for migration, backwards in plan))
|
||||
self.stdout.write(
|
||||
self.style.NOTICE(
|
||||
"\nYou have %(unpplied_migration_count)s unapplied migration(s). "
|
||||
"Your project may not work properly until you apply the "
|
||||
"migrations for app(s): %(apps_waiting_migration)s." % {
|
||||
"unpplied_migration_count": len(plan),
|
||||
"apps_waiting_migration": ", ".join(apps_waiting_migration),
|
||||
}
|
||||
)
|
||||
)
|
||||
self.stdout.write(self.style.NOTICE("Run 'python manage.py migrate' to apply them.\n"))
|
||||
|
||||
# Kept for backward compatibility
|
||||
|
||||
Reference in New Issue
Block a user