peopledoc / django-north

Django library for managing and executing hand-written PostgreSQL migrations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Django North

image

image

image

image

Django library for managing and executing hand-written PostgreSQL migrations.

Let your favorite DBAs define the database schema, and provide blue/green migration files. Drop django native migrations, and use DBA's migrations everywhere.

Requirements

  • Postgresql only
  • Django v1.11, v2.0, v2.1, v2.2
  • Running under Python 3.6, 3.7 or 3.8

Documentation

The full documentation is at https://django-north.readthedocs.org.

Quickstart

Install Django North:

pip install django-north

In your settings.py :

INSTALLED_APPS = [
    # ...
    "django_north",
]

NORTH_MANAGE_DB = True
NORTH_MIGRATIONS_ROOT = '/path/to/sql/migrations/'
NORTH_TARGET_VERSION = '1.42'

Running Tests

You will need a usable Postgresql database in order to test the project. For example:

source <YOURVIRTUALENV>/bin/activate
export DATABASE_URL=postgres://USER:PASSWORD@HOST:PORT/NAME
(myenv) $ pip install -r requirements_test.txt

Run tests for a specific version

(myenv) $ ./runtest

Run tests for all versions (if tox is installed globally, you don't need a virtual environment)

$ tox

Using the project

Many operations are documented in the Makefile. For more information, use:

$ make help

Credits

Tools used in rendering this package:

About

Django library for managing and executing hand-written PostgreSQL migrations

License:MIT License


Languages

Language:Python 79.9%Language:PLpgSQL 18.7%Language:Makefile 1.1%Language:Shell 0.3%