Skip to main content

Squash migrations in django.contrib.auth for better performance and nicer output

As requested on the Django Ticket Tracker, but as a separate package.

Why?

  • Faster migrations (for every (test) run)!
  • Less pollution on screen

Counter-arguments about supposed breaking changes, stability etc. can be simply refuted by the fact that all such arguments would equally apply to any use of squashed migrations.

I believe in squashmigrations, so let's just "squash all the things"!

Usage

pip install squashed-users
# migrate as usual

How it's made

On Django 4.2, the following was run:

pyton manage.py squashmigrations auth 0001 0012

The comments in the generated file were followed (copying RunMigration code over).

Then, the file was moved from my virtualenv to this package.

(No django.contrib.auth migrations have been made between Django 4.2 and 5.2, so this works for any supported Django version)

A Magic Wheel A.K.A. package-level Monkey-patching

django/contrib/auth/migrations/0001_squashed_0012_alter_user_first_name_max_length.py is the only file in this "package", no __init__.py in any of the directories, and nothing else.

Surprisingly, such a setup "works" in the sense that this squashed migration ends up in the right location, whether you install this package or Django first. Django then sees the file, and the usual migration magic kicks in from there.

Metadata

Release files for squashed-users 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for squashed-users 1.0.0
File Size Uploaded Provenance
squashed_users-1.0.0.tar.gz 5.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for squashed-users 1.0.0
File Interpreter ABI Platform
squashed_users-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / squashed_users-1.0.0.tar.gz

Download URL squashed_users-1.0.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5047415c7c063e668d64a5068d2bfc5f262e4c1f342730b700cef6e395f71c63
BLAKE2b-256 checksum
How to use checksums
c3b2f4dafeb48991b611c6541536ffedbedf560f19a8636e47d39ecb7673b351
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / squashed_users-1.0.0-py3-none-any.whl

Download URL squashed_users-1.0.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b29607d835aff837669a758cee84616e514e2fd32f14dd7965b15858ad714604
BLAKE2b-256 checksum
How to use checksums
16954eec3413c87da9c6b35715cfe44dc2b1f31e3c27d5864c1f9fd1199be16d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Security for squashed-users 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page