Skip to main content

django.contrib.auth migrations squashed into a single migration

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

squashed_users-1.0.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

squashed_users-1.0.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file squashed_users-1.0.0.tar.gz.

File metadata

  • Download URL: squashed_users-1.0.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for squashed_users-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5047415c7c063e668d64a5068d2bfc5f262e4c1f342730b700cef6e395f71c63
MD5 560b7a7b761fec14867a49f34c59d6eb
BLAKE2b-256 c3b2f4dafeb48991b611c6541536ffedbedf560f19a8636e47d39ecb7673b351

See more details on using hashes here.

File details

Details for the file squashed_users-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: squashed_users-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for squashed_users-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b29607d835aff837669a758cee84616e514e2fd32f14dd7965b15858ad714604
MD5 fdecb380c4414c49b8f814de21e54650
BLAKE2b-256 16954eec3413c87da9c6b35715cfe44dc2b1f31e3c27d5864c1f9fd1199be16d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page