summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-05-17 13:14:43 +0200
committerGitHub <noreply@github.com>2023-05-17 13:14:43 +0200
commitc52f4295f254e1c14af769d22b1a5f516a941f58 (patch)
tree8770afde4c44cb372b24d468f33d61ecab5c387e /django
parent93830abf7694e0f281931f10eeaa34993855e7dd (diff)
downloaddjango-c52f4295f254e1c14af769d22b1a5f516a941f58.tar.gz
Fixed #34568 -- Made makemigrations --update respect --name option.
Thanks David Sanders for the report.
Diffstat (limited to 'django')
-rw-r--r--django/core/management/commands/makemigrations.py5
1 files changed, 2 insertions, 3 deletions
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: