Skip to main content

Generate a green migration files for Django

Project description

django-green-migrations

Version 1.1.3

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.3.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_green_migration-1.1.3-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_green_migration-1.1.3.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

Hashes for django_green_migration-1.1.3.tar.gz
Algorithm Hash digest
SHA256 ce5b169d2999d20bd1fac837bc3f6a3d81ee9981c2ea65b643234e0e0d2c3dd6
MD5 5e0b2bc5ec3700a1875f24507b4db1b5
BLAKE2b-256 c44d49317effc54bef3eb3199894a9444cdd3edb78b81b834822d9a0d3c0bd9d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_green_migration-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4a1dfcb18197fcac1353307d195284eab22efdfab65582821971665df09e8d0f
MD5 9fe55781e0d62a783bfc5292bdc3748d
BLAKE2b-256 a29dff6a66643f2a895bd47929f55aec7ae4e47dd3c410b02ee6ceec40199bd8

See more details on using hashes here.

Supported by

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