Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/browniebroke/django-remake-migrations
A Django admin command to recreate all migrations in a project.
https://github.com/browniebroke/django-remake-migrations
database django hacktoberfest migrations
Last synced: 20 days ago
JSON representation
A Django admin command to recreate all migrations in a project.
- Host: GitHub
- URL: https://github.com/browniebroke/django-remake-migrations
- Owner: browniebroke
- License: mit
- Created: 2023-10-09T16:32:07.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-22T11:11:54.000Z (6 months ago)
- Last Synced: 2024-05-22T19:07:40.987Z (6 months ago)
- Topics: database, django, hacktoberfest, migrations
- Language: Python
- Homepage: https://django-remake-migrations.readthedocs.io
- Size: 313 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Django remake migrations
---
**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](https://docs.djangoproject.com/en/stable/ref/django-admin/#optimizemigration) 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 migrationsThis 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](https://allcontributors.org/docs/en/emoji-key)):
Bruno Alla
💻 🤔 📖
Dmytro Litvinov
📖
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
## Credits
This package was created with
[Copier](https://copier.readthedocs.io/) and the
[browniebroke/pypackage-template](https://github.com/browniebroke/pypackage-template)
project template.