Version 1.0.5
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.
- 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.
- 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.
- 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)