1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #35122 -- Made migrate --prune option respect --app_label.

This commit is contained in:
Moein Bbp
2024-01-17 23:45:52 +03:30
committed by Mariusz Felisiak
parent 222bf2932b
commit cf107fe255
4 changed files with 82 additions and 5 deletions

View File

@@ -195,8 +195,11 @@ class Command(BaseCommand):
)
if self.verbosity > 0:
self.stdout.write("Pruning migrations:", self.style.MIGRATE_HEADING)
to_prune = set(executor.loader.applied_migrations) - set(
executor.loader.disk_migrations
to_prune = sorted(
migration
for migration in set(executor.loader.applied_migrations)
- set(executor.loader.disk_migrations)
if migration[0] == app_label
)
squashed_migrations_with_deleted_replaced_migrations = [
migration_key
@@ -222,9 +225,6 @@ class Command(BaseCommand):
)
)
else:
to_prune = sorted(
migration for migration in to_prune if migration[0] == app_label
)
if to_prune:
for migration in to_prune:
app, name = migration