Smart reversion of Django migrations based on Git diff
Project description
If you are in a complex Django project, sometimes you will find yourself switching between multiple branches, some of which can add a number of database migrations. Before switching back to master you will have to unapply all migrations that are specific to the current branch. To make things worse, in order to unapply Django migrations, you have to enter the migration that comes right before the first migration of the current branch. It’s not that big of a deal, Django is smart enough to let you use an unambiguos prefix of any migration, but with this package you can speed things up a little bit.
While standing on any branch, you can use:
python manage.py unmigrate master
Or if it’s going to be master anyways, this will suffice:
python manage.py unmigrate
And that’s it!
A little deeper
Ok, you can do more than that.
Do you need to unapply your migrations from the same branch, a few commits behind? Here’s how:
python manage.py unmigrate HEAD~5 python manage.py unmigrate af332b python manage.py unmigrate v1.33.7
If you only want to see the target migrations:
python manage.py unmigrate --dry-run
And if you just want to play with this, go ahead and unapply your migrations with fake. Just don’t forget to apply them again:
python manage.py unmigrate --fake python manage.py migrate --fake
Contributing
Join the discussion at https://gitter.im/django-unmigrate/community.
PRs are welcome! If you have questions or comments, please use the link above.
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
Built Distribution
File details
Details for the file django-unmigrate-0.1.0.tar.gz
.
File metadata
- Download URL: django-unmigrate-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a93db182a60e05b27a68080ac9ca4d3b7d201ec0a8496aad8b987a4b44270a77 |
|
MD5 | 6d80c4f6f5db45060808b660087c346e |
|
BLAKE2b-256 | 29d440dcdda7692aa7538d5445ebe9332986e7ec1e287c78a78693d8402e3df5 |
File details
Details for the file django_unmigrate-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: django_unmigrate-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdea8cfb9134ffeeb8425a58ffb658748dc2b0d7b2f40604e8512398f09a3d2a |
|
MD5 | 7efc748dfb8c1c7867f58948738ac7b9 |
|
BLAKE2b-256 | a02b6ead52764e2dd61138bdc534c74a3c12372a7b7e2dad82a8a3ab003f0f7b |