Skip to main content

Yet another way to manage migrations: DBA as a service

Project description

https://badge.fury.io/py/django-north.png https://travis-ci.org/peopledoc/django-north.png?branch=master https://readthedocs.org/projects/django-north/badge/ https://img.shields.io/codecov/c/github/peopledoc/django-north/master.svg

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:

History

0.3.2 (2022-02-07)

  • Add Django 3 compatibility

  • Add Github actions

  • Fix settings initialization

  • Pin pytest_django version to solve a known multidb issue

  • Add postgres docker container

  • Pin psycopg2 version to fix utc issue due to incompatible types

0.3.1 (2020-07-24)

  • Fix septentrion call in runserver

  • Bump to septentrion 0.6.1

0.3.0 (2020-07-24)

  • Remove setting “NORTH_DISCARD_ALL”

  • Add function for septentrion settings

  • Fix classifiers

  • Removed the internal logic for applying migrations, use septentrion instead.

0.2.6 (2019-10-25)

  • Add support for Django 2.2

  • NORTH_AFTER_SCHEMA_FILES and NORTH_BEFORE_SCHEMA_FILES can now accept glob string.

0.2.5 (2019-01-22)

  • Add support for Django 2.1 & Python 3.7

  • Add setting NORTH_AFTER_SCHEMA_FILES for schema files after the main schema.

  • Adding setting NORTH_BEFORE_SCHEMA_FILES, to replace NORTH_ADDITIONAL_SCHEMA_FILES.

  • Deprecate setting NORTH_ADDITIONAL_SCHEMA_FILES.

0.2.4 (2018-09-12)

  • Use –database option to determine which database to use in migrate command (#35)

0.2.3 (2018-06-15)

  • Add support for Django 2.0 (#31)

  • Add a “DISCARD ALL” command run at the end of each script. It adds a new settings variable: NORTH_DISCARD_ALL (#33)

0.2.2 (2018-02-01)

  • Flush command: do not flush migration tables.

0.2.1 (2018-01-29)

  • Add VACUUM to NORTH_NON_TRANSACTIONAL_KEYWORDS default settings.

  • Add a setting NORTH_SCHEMA_VERSION to force the schema to be used to init a DB.

0.2.0 (2017-10-16)

  • Backport the sqlall command.

  • Sanitize sql statements for SimpleBlock.

0.1.8 (2017-09-20)

  • Detect manual files if not stored in the ‘manual’ dir.

  • Fix unicode error with SimpleBlock

0.1.7 (2017-09-06)

  • Fix get_applied_versions result ordering.

0.1.6 (2017-09-05)

  • Add tests for Django 1.11.

0.1.5 (2017-05-24)

  • Fix showfixtures command for Django 1.10.

0.1.4 (2017-05-10)

  • Do not fail if fixtures do not exist. Use the closest fixtures for DB init and flush command.

  • Add support of python3.

0.1.3 (2017-04-18)

  • Use a Block if the sql file contains a ‘ALTER TYPE’ instruction Add a setting to customize the files to run in a Block.

0.1.2 (2017-04-13)

  • Use a Block if the sql file contains a CONCURRENTLY instruction.

0.1.1 (2017-04-11)

  • Add the possibility to configure the current version detector.

0.1.0 (2017-03-28)

  • First release on PyPI.

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-north-0.3.2.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

django_north-0.3.2-py2.py3-none-any.whl (17.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-north-0.3.2.tar.gz.

File metadata

  • Download URL: django-north-0.3.2.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for django-north-0.3.2.tar.gz
Algorithm Hash digest
SHA256 a3f66eea4cfbe5dd92c4e77004943076bbf8a1cdcde4f0d6c6951ae2af2537bd
MD5 c0f7c080e85ff9918fac90d32b371c92
BLAKE2b-256 1c42a41ec4ec516bd0f65f2b77a7a2eaa6f2dc2a2e2d5c8ff335bb85c003306e

See more details on using hashes here.

File details

Details for the file django_north-0.3.2-py2.py3-none-any.whl.

File metadata

  • Download URL: django_north-0.3.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for django_north-0.3.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 939072e4c7276d2e5d9f3757964cdbb94e21c2d49540ac052a32a58036021f23
MD5 08925e4973c5d4fea461fe1a55c6280b
BLAKE2b-256 b6975685450a7217493dc56dca611d670689aafeb22bacf31853a1887a8506f0

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