summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMoein Bbp <bbp.moein@yahoo.com>2024-01-17 23:45:52 +0330
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2024-02-13 14:47:49 +0100
commitcf107fe255dbc4e1619c0985e4becdd9cabe8235 (patch)
tree4098f4e0b0dca449cce16a6dc3df5d57198b8084 /django
parent222bf2932b55ebc964ffc5f9a6f47bad083e5ac2 (diff)
Fixed #35122 -- Made migrate --prune option respect --app_label.
Diffstat (limited to 'django')
-rw-r--r--django/core/management/commands/migrate.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/django/core/management/commands/migrate.py b/django/core/management/commands/migrate.py
index 1541843066..3a0e9e87ff 100644
--- a/django/core/management/commands/migrate.py
+++ b/django/core/management/commands/migrate.py
@@ -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