From c52f4295f254e1c14af769d22b1a5f516a941f58 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Wed, 17 May 2023 13:14:43 +0200 Subject: Fixed #34568 -- Made makemigrations --update respect --name option. Thanks David Sanders for the report. --- django/core/management/commands/makemigrations.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'django') diff --git a/django/core/management/commands/makemigrations.py b/django/core/management/commands/makemigrations.py index 284a95409f..35661d4997 100644 --- a/django/core/management/commands/makemigrations.py +++ b/django/core/management/commands/makemigrations.py @@ -316,9 +316,8 @@ class Command(BaseCommand): ) # Update name. previous_migration_path = MigrationWriter(leaf_migration).path - suggested_name = ( - leaf_migration.name[:4] + "_" + leaf_migration.suggest_name() - ) + name_fragment = self.migration_name or leaf_migration.suggest_name() + suggested_name = leaf_migration.name[:4] + f"_{name_fragment}" if leaf_migration.name == suggested_name: new_name = leaf_migration.name + "_updated" else: -- cgit v1.2.1