`zeromigrations` command for django to set migrations zero with backup feature
Project description
As the project grows up, the number of migration files increases over time. As a result, running them can consume a lot of time, specifically when you are running your tests.
zeromigrations is a command to reset migration files (I SUGGEST NOT TO CALL IT ON PRODUCTION). It basically runs 4 command:
migrate --fake {app_name} zero for each app
Remove old migration files, As new migrations is going to be generated.
makemigrations to generate initial migration file.
migrate --fake-initial to fake generated initial files.
But besides that, this command can make a backup to restore in case of any failure.
Note that migrate --fake command only runs for your own apps and django apps like contenttype and third-party apps are excluded.
Installation
First install the package:
pip3 install django-zeromigrations
Then add it to your INSTALLED_APPS:
INSTALLED_APPS = [
...
"zero_migrations"
]
Usage
First, run the command:
python manage.py zeromigrations
I suggest to make a backups from both your migrations and django_migrations table (just in case).
1- make backup
2- restore last backup
3- just proceed
If you choose 1- make backup, it would make a backup then zero migrations.
If you choose 2- restore last backup, it tries to restore the latest backup that can be found. If not backup found, it would raise an error.
If you choose 3- just proceed, it assumes that you already have your own backup and start setting migrations zero.
Project details
Release history Release notifications | RSS feed
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
Hashes for django-zeromigrations-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | af41641e15ac13dbe42b552a22118a583283e8de0801e5c7afc31b3f6e97aef1 |
|
MD5 | 55f3bf528baf5e896ae9ae1916365ff5 |
|
BLAKE2b-256 | 0f1b2f33788e6c4aa327bc4f2e93be93b80653ee50746aa4fe705cf251fa2f6c |
Hashes for django_zeromigrations-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6dc5612599ea6b8f2e9aef571802332023f8d898b7bd6206d081c7a7eb154913 |
|
MD5 | 596fa81a2bc09cdf563fc46d5633d177 |
|
BLAKE2b-256 | ef52a5e5962a982361afbf34d5e8512ff9b9465fea6a4fc5a4e767384bf754cb |