Skip to main content

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

  1. Deploy new code to server
  2. Keep server running
  3. Run migrations
  4. Switch to new code
  5. Destroy old code

At step 3, if the migration contains a field drop, the server will be down.

Green deployment

  1. Deploy new code to server
  2. Keep server running
  3. Run green migration python manage.py green_migrate > output.json
  4. Run migrations
  5. Switch to new code
  6. Destroy old code
  7. 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

  1. Install package pip install django-green-migration
  2. Add green_migration to INSTALLED_APPS
  3. Setup deployment like above explanation (make sure don't commit changes at step 3 to git)

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

django_green_migration-1.1.2.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

django_green_migration-1.1.2-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file django_green_migration-1.1.2.tar.gz.

File metadata

File hashes

Hashes for django_green_migration-1.1.2.tar.gz
Algorithm Hash digest
SHA256 8b646da49f858c83fda7df37b2046e08ed3f7bb8f527479b71d55912a298a409
MD5 c539d6b0ce00408908d7c9e3507bd09a
BLAKE2b-256 9cf18e186a4cb633334b742658698d552966a2ac8b276ba381a43567814f8bea

See more details on using hashes here.

File details

Details for the file django_green_migration-1.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_green_migration-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d89cc32b1d5ef1662c5c0b196107b750526917b08055ca019300fd484ce703d5
MD5 afbc45b9bf03ebeb4a913921d48245e0
BLAKE2b-256 b55fb84fdf069ed8122eb7c631e78d308e48951f4b7a7cda847819bdd52a8f75

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page