Git Product home page Git Product logo

django-green-migration's Introduction

django-green-migrations

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.

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)

django-green-migration's People

Contributors

bang-eoh avatar dependabot[bot] avatar

Stargazers

 avatar

Forkers

bang-eoh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.