Skip to main content

Automatically reverses Django migrations when changing git branches

Project description

great-scott

great-scott is a tool that can automatically reverse migrations in a Django project, when switching between different GIT branches.

InstallationUsageRemoving GIT hooks

doc

Installation

great-scott can be installed in 2 easy steps:

  1. Install the tool

    I recommend installing via pipx:

    pipx install great-scott
    

    Alternatively, having the project's virtual-env activated, you can of course install the tool directly into virtual-env:

    python -m pip install great-scott
    
  2. Setup GIT hooks

    After successful installation, while in the GIT-managed project folder and with virtual-env activated, execute:

    great-scott install
    

Usage

Reversing migrations should simply work when the GIT branch is changed:

$ git checkout mig-test
Switched to branch 'main'
👀 Looking for migrations to reverse on mig-test...
⚠️ reversing migrations for importer (up to 0015)
⚠️ reversing migrations for permissions (up to 0018)
⚠️ reversing migrations for subscriptions (up to 0044)
I have reversed migrations for 3 apps!

👉 If you use GIT integration in any of the popular IDEs, such as PyCharm or VSCode, don't forget to properly configure the appropriate python environment there so that automatic reversing of migrations is possible.

Removing GIT hooks

To remove the GIT hooks, execute the command (while in the project directory and with virtual-env activated):

great-scott uninstall

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

great_scott-0.1.0.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

great_scott-0.1.0-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

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