django-check-migration-wtf
Description
django-check-migration-wtf is an extension for Django to check migrations and notify you if their are secure to do on environments with zero downtime.
In some situations Django Migration system generate migrations to need do a downtime because they are blocking operation or you write custom migration than can block you database.
Actually this extension only works for backends of PostgresSQL and Postgis.
Advise: this extension notify you for common blocking operations on database. Anyway you should review your migrations and understand their.
Configuration
It is really simple
Installation
Install the package with the typical tool (pip):
pip install django-check-migration-wtf
Add to your project
Add app on your settings:
INSTALLED_APPS = [
'django_check_migration_wtf',
...,
]
Add some optional vars
Add some optional setup on your settings:
CHECK_MIGRATION_WTF_PSQL_VERSIONIt is to know your PostgresSQL Version by default it is 9- The next following vars are for use github integration:
CHECK_MIGRATION_WTF_GITHUB_TOKENToken to can use API of github, It only need permission of reading of repo.CHECK_MIGRATION_WTF_REPO_NAMEName of repository on Github
Usage
It is really easy to use. It is execute by a typical django command like makemigrations or migrate...
It has two mode of usage.
Local
First execute your makemigrations and you can do your custome modifications. Then before execute command migrate
execute the following command:
python manage.py check_migration
It will search all migrations that are not apply to the system (like showmigrations) and it will analyze if they are secure to do.
You can have two possibilities:
-
When the migration or migrations are secure, you get the following response:
-
When the migration or migrations are not secure, you get the following response:
Github
This is reality an option of command to execute it on your continues integration. It will search you migrations comparing the base branch and your current branch and the analyze it
python manage.py check_migration --github <head_ref> <base_ref>
Limitations
- This extension not analyze code inside of
RunPython - Github option to work correctly suppose your migrations are inside of directory migrations
Release files for django-check-migration-wtf 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-check-migration-wtf-1.2.0.tar.gz | 25.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_check_migration_wtf-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 56.8 kB
Release files / django-check-migration-wtf-1.2.0.tar.gz
| Download URL | django-check-migration-wtf-1.2.0.tar.gz |
|---|---|
| Size | 25.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e23912b498a9de4a245d4245dca082eee3530775c646fdc88ba4d8df1f2f874a
|
|
BLAKE2b-256 checksum How to use checksums |
61479480120b2bb488c7fc6d28c70f54b07d65507f17b6e059f5edf4b8a3725f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
|
Release files / django_check_migration_wtf-1.2.0-py3-none-any.whl
| Download URL | django_check_migration_wtf-1.2.0-py3-none-any.whl |
|---|---|
| Size | 31.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b34b11bd2a180bc772ccd7a236036bc0f64f0abc1dc05f585a654cedb5a0b6d
|
|
BLAKE2b-256 checksum How to use checksums |
4b2520fd2f09c69b9929fea368de5eaa64025aa891ef8cf63d9133d1bf3a6c57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
|