Skip to main content

Liquidb is a Django app that simplifies migration management.

Project description

Liquidb

Liquidb is a Django app that simplifies migration management. It introduces commits (savepoints) that allows developer to take snapshot of current migration state of whole Django project. Snapshot introduces abstraction layer, which let you easily switch back and forth in complicated migration graph of dependent apps. In order to roll(back/forward) all migrations should be revertable.

Requirements

Django Liquidb requires: * Django 3.2 or later; * Python 3.8 or later.

Getting It

You can get Django Liquidb by using pip::

$ pip install django-liquidb

If you want to install it from source, grab the git repository from GitHub and run setup.py::

$ git clone git@github.com:Gusakovskiy/django-liquidb.git
$ cd django-liquidb
$ python setup.py install

Quick start

  1. Add "Liquidb" to your INSTALLED_APPS setting like this:

     INSTALLED_APPS = [
         ...
         'liquidb',
     ]
    
  2. Run python manage.py migrate liquidb to create the liquidb models.

  3. Create initial commit python manage.py create_migration_snapshot --name init

Using It

Create snapshot of your current state::

$ branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
$ hash=$(git rev-parse $branch)
$ python manage.py create_migration_snapshot --name $branch-${hash:0:8}

In case you want to overwrite some snapshot::

$ python manage.py create_migration_snapshot --name $branch-${hash:0:8} --overwrite 1

Return to desired state of db::

$ python manage.py checkout_snapshot --name state_name

Return to latest snapshot::

$ python manage.py checkout_latest_snapshot

If snapshot history is messed up you always can delete it without impact on your migration state and start from scratch::

$ python manage.py delete_snapshot_history

If want to delete only one snapshot(it can not delete currently applied snapshot remember to checkout before that)::

$ python manage.py delete_snapshot_by_name --name name

Or if you prefer admin vies you can always visit /admin/liquidb/snapshot/ and create/apply/delete snapshot there.

If you would like to change to readonly view in admin please change ADMIN_SNAPSHOT_ACTIONS env variable to False or overwrite it you settings

Getting Involved

Open Source projects can always use more help. Fixing a problem, documenting a feature, adding translation in your language. If you have some time to spare and like to help us, here are the places to do so:

Development

Generating dependencies

Main dependencies::

$ pip-compile --upgrade --resolver backtracking  --output-file requirements.txt pyproject.toml

Dev dependencies::

$ pip-compile --upgrade --resolver backtracking --extra dev --output-file requirements-dev.txt pyproject.toml

If you see error that you can't figure out try to add --verbose flag

After generating dependencies remember to change backports.zoneinfo==0.2.1 to backports.zoneinfo;python_version<"3.9" this dependency is not supported by Python >= 3.9, it should be deleted after support for those versions is ended.

Configure environment

In you local machine create virtual environment and activate it or setup docker container and run command::

$ pip install -r requirements-dev.txt

To run test::

$ pytest tests

To run linting::

$ pylint --load-plugins=pylint_django --django-settings-module=liquidb.pylint_settings liquidb

Support

Django Liquidb is development and maintained by developers in an Open Source manner. Any support is welcome. You could help by writing documentation, pull-requests, report issues and/or translations.

Please remember that nobody is paid directly to develop or maintain Django Liquidb so we do have to divide our time between work/family/hobby/this project and the rest of life.

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-liquidb-0.4.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

django_liquidb-0.4-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file django-liquidb-0.4.tar.gz.

File metadata

  • Download URL: django-liquidb-0.4.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for django-liquidb-0.4.tar.gz
Algorithm Hash digest
SHA256 be9243ed2235e52f589a8848f948373144c912f3b019a9492030c3edff386a59
MD5 5f078f8a3844812c6c8a31212e406024
BLAKE2b-256 15b7df79de0cebb3ced1293df34f2c8ec9af2f28d1a2dde7d9dce0ebbe89fadc

See more details on using hashes here.

File details

Details for the file django_liquidb-0.4-py3-none-any.whl.

File metadata

  • Download URL: django_liquidb-0.4-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for django_liquidb-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cbd5aeb30b81b9268d17a7da8dcc6d63bb00c597ac3b1d20965afd18f6770432
MD5 6030a0e32af54b82020594cdd1032a68
BLAKE2b-256 892cfa0093e66cb4002967ba2cb99e0de48904e2618e9d016ad93fa20ec00685

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