Skip to main content

A Django admin command to recreate all migrations in a project.

Project description

Django remake migrations

CI Status Documentation Status Test coverage percentage

Poetry black pre-commit

PyPI Version Supported Python versions License


Documentation: https://django-remake-migrations.readthedocs.io

Source Code: https://github.com/browniebroke/django-remake-migrations


A Django admin command to recreate all migrations in a project. Like a squashmigrations command on steroids.

The problem

The built-in squashmigrations command is great, but it has some limitations:

  • It only works on a single app at a time, which means that you need to run it for each app in your project. On a project with enough cross-apps dependencies, it quickly becomes impossible to run.
  • It doesn't optimise the operations, it only reduces the number of migration files. That being said, Django 4.1 introduced a new optimizemigrations command which sounds like it might be doing just this.

This command aims at solving this problem, by recreating all the migration files in the whole project, from scratch, and mark them as applied by using the replaces attribute.

It makes an important trade-off though: it does NOT try to be correct when setting the replaces attribute. The only guarantees are that:

  • all old migrations are marked as replaced once.
  • all new migrations replace at least one of the old migrations

This is OK to make this trade-off as long as all your environments are fully migrated when you deploy the remade migrations.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Bruno Alla
Bruno Alla

💻 🤔 📖
Dmytro Litvinov
Dmytro Litvinov

📖

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits

This package was created with Copier and the browniebroke/pypackage-template project template.

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

django_remake_migrations-1.1.2.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

django_remake_migrations-1.1.2-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file django_remake_migrations-1.1.2.tar.gz.

File metadata

File hashes

Hashes for django_remake_migrations-1.1.2.tar.gz
Algorithm Hash digest
SHA256 1b710946570ab0f881c0787895c16ffcfae9cb74074fa5ed3f26343bd2d716bd
MD5 19d3508e5cc2c0acb177d8ceeee31478
BLAKE2b-256 799a6d35f09340a64e61712f2af1ca64b234c54b34fc11a881c4bb4f8873dc0c

See more details on using hashes here.

File details

Details for the file django_remake_migrations-1.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_remake_migrations-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c21c42e8874c0640e2b26e43e9260acaa1d184a4e9b8fcd0512a33424d978ca7
MD5 651a59f2cbedf915ec7f9015064ab174
BLAKE2b-256 1d165f2e1bc9ab964830bfced8ce001d495fde1924a7fb517835e3b68560279b

See more details on using hashes here.

Supported by

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