Generate a green migration files for Django
Project description
django-green-migrations
Version 1.1.4
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_migrationtoINSTALLED_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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_green_migration-1.1.4.tar.gz.
File metadata
- Download URL: django_green_migration-1.1.4.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e4c2f4fda9aed5999039beb2b70a3ed63615eb848ba98ed6604369512aa452a
|
|
| MD5 |
8df8bbb6a40ee869c018b98ff6be8891
|
|
| BLAKE2b-256 |
ff7ae0e6f940afaccf14cfe43cc06f0f0b544d9c7a245dff0d9eb9ebbf6190ae
|
File details
Details for the file django_green_migration-1.1.4-py3-none-any.whl.
File metadata
- Download URL: django_green_migration-1.1.4-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3cb82ccc36f4bf795c5ee8ec14e10bb764bd338e2c80e118962ace6414f2043
|
|
| MD5 |
4e95550234ccfa7356af207eec7832d8
|
|
| BLAKE2b-256 |
fb2a33cf849e1e26f06762735c14d4d6af289ef0a924fd785c339413946e5186
|