Generate a green migration files for Django
Project description
django-green-migrations
Warning: this package is under development, please use with your own risk. Version 1.1.1
While the server is running, if you deploy a new version which contains a migration that drop a field, it will make your production down. This is because the migration will be executed before the new code is deployed. This package will help you to avoid this problem.
Normal deployment
- Deploy new code to server
- Keep server running
- Run migrations
- Switch to new code
- Destroy old code
At step 3, if the migration contains a field drop, the server will be down.
Green deployment
- Deploy new code to server
- Keep server running
- Run green migration
python manage.py green_migrate > output.json
- Run migrations
- Switch to new code
- Destroy old code
- Run pos green migration
python manage.py pos_green_migrate output.json
At step 3, it will modify drop
migration to nullable and blankable
migration, this will help both old and new code to work.
At step 7, it will read the output from step 3 to drop fields, this will help to clean up the database.
Installation
- Install package
pip install django-green-migration
- Add
green_migration
toINSTALLED_APPS
- Setup deployment like above explanation (make sure don't commit changes at step 3 to git)
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
File details
Details for the file django_green_migration-1.1.2.tar.gz
.
File metadata
- Download URL: django_green_migration-1.1.2.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b646da49f858c83fda7df37b2046e08ed3f7bb8f527479b71d55912a298a409 |
|
MD5 | c539d6b0ce00408908d7c9e3507bd09a |
|
BLAKE2b-256 | 9cf18e186a4cb633334b742658698d552966a2ac8b276ba381a43567814f8bea |
File details
Details for the file django_green_migration-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: django_green_migration-1.1.2-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d89cc32b1d5ef1662c5c0b196107b750526917b08055ca019300fd484ce703d5 |
|
MD5 | afbc45b9bf03ebeb4a913921d48245e0 |
|
BLAKE2b-256 | b55fb84fdf069ed8122eb7c631e78d308e48951f4b7a7cda847819bdd52a8f75 |