#35707: Squash migrations in django.contrib.auth for better performance and nicer
output
-------------------------------------+-------------------------------------
Reporter: Tim Abbott | Type:
| Cleanup/optimization
Status: new | Component:
| contrib.auth
Version: 5.0 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Provisioning a fresh database for any project using Django's contrib.auth
system ends up spending about 0.3 seconds, and probably more importantly a
nontrivial amount of output on the screen running the 12 migrations in
django.contrib.auth in sequence. This can be optimized significantly by
squashing the migrations using the `manage.py squashmigrations` algorithm.
Sample output using `ts "%b %d %H:%M:%.S"` for timing output:
Aug 23 17:07:23.116481 Applying
auth.0002_alter_permission_name_max_length... OK
Aug 23 17:07:23.131759 Applying auth.0003_alter_user_email_max_length...
OK
Aug 23 17:07:23.149192 Applying auth.0004_alter_user_username_opts... OK
Aug 23 17:07:23.166695 Applying auth.0005_alter_user_last_login_null...
OK
Aug 23 17:07:23.169690 Applying auth.0006_require_contenttypes_0002...
OK
Aug 23 17:07:23.191648 Applying
auth.0007_alter_validators_add_error_messages... OK
Aug 23 17:07:23.207522 Applying
auth.0008_alter_user_username_max_length... OK
Aug 23 17:07:23.234117 Applying
auth.0009_alter_user_last_name_max_length... OK
Aug 23 17:07:23.332708 Applying auth.0010_alter_group_name_max_length...
OK
Aug 23 17:07:23.417119 Applying auth.0011_update_proxy_permissions... OK
Aug 23 17:07:23.433407 Applying
auth.0012_alter_user_first_name_max_length... OK
The django.contrib.auth.migrations tree hasn't see any new migrations
since migration `0012_alter_user_first_name_max_length.py` was added in
2020, so it seems fairly likely that this won't need to be done on a
recurring basis.
--
Ticket URL: <
https://code.djangoproject.com/ticket/35707>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.