1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #31703 -- Made makemigrations name all initial migrations "initial".

When the MigrationAutodetector creates more than one initial migration
in a app, name all initial migrations "initial" rather than the opaque
"auto_<DATE>_<TIME>" name.

Initial migrations that have a descriptive name continue to use the
descriptive name.
This commit is contained in:
Jon Dufresne
2020-06-13 10:06:05 -07:00
committed by Mariusz Felisiak
parent 01195c4a83
commit 6f3e3e87ab
2 changed files with 29 additions and 1 deletions

View File

@@ -192,7 +192,7 @@ class Migration:
):
name = '_'.join(sorted(o.migration_name_fragment for o in self.operations))
if name is None:
name = 'auto_%s' % get_migration_name_timestamp()
name = 'initial' if self.initial else 'auto_%s' % get_migration_name_timestamp()
return name