#35707: Squash migrations in django.contrib.auth for better performance and
nicer
output
-------------------------------------+-------------------------------------
Reporter: Tim Abbott | Owner: (none)
Type: | Status: closed
Cleanup/optimization |
Component: contrib.auth | Version: 5.0
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):
* resolution: => wontfix
* status: new => closed
Comment:
Here is a bench from my development machine.
Python 3.12.1
Apple M2 Pro
Django 5.2.a-0@cdcd604ef8f650533eff6bd63a517ebb4ffddf96
Postgres 15.4
**Current: 0.137s**
{{{
Running migrations:
Applying auth.0001_initial... OK (0.071s)
Applying auth.0002_alter_permission_name_max_length... OK (0.005s)
Applying auth.0003_alter_user_email_max_length... OK (0.003s)
Applying auth.0004_alter_user_username_opts... OK (0.003s)
Applying auth.0005_alter_user_last_login_null... OK (0.004s)
Applying auth.0006_require_contenttypes_0002... OK (0.001s)
Applying auth.0007_alter_validators_add_error_messages... OK (0.003s)
Applying auth.0008_alter_user_username_max_length... OK (0.010s)
Applying auth.0009_alter_user_last_name_max_length... OK (0.003s)
Applying auth.0010_alter_group_name_max_length... OK (0.004s)
Applying auth.0011_update_proxy_permissions... OK (0.026s)
Applying auth.0012_alter_user_first_name_max_length... OK (0.004s)
}}}
**Squashed: 0.093s**
{{{
Running migrations:
Applying
auth.0001_initial_squashed_0012_alter_user_first_name_max_length... OK
(0.093s)
}}}
----
That's a savings of about 1/3 of the migration time, or 0.044s on an
admittedly fast machine (so double it for cloud CI). Given that this would
impose a breaking change on users (and the verbosity can already be
silenced with `-v0`), I don't see the value outweighing the cost. We also
have guidance in the migrations docs about not worrying about the number
of migrations until you have
[https://docs.djangoproject.com/en/5.1/topics/migrations/#squashing-
migrations hundreds].
--
Ticket URL: <https://code.djangoproject.com/ticket/35707#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701918edc9917-d9c4909f-d8a5-40eb-92f5-5236bf74b781-000000%40eu-central-1.amazonses.com.