Extraction tool for data only django migrations
Project description
django-data-migration
Missing migration?
/ \
yes, migrate no, continue
\ /
restart app with new code
Installation
Install package:
Configure package in Django settings:
INSTALLED_APPS = [
# django apps
'data_migration',
# your apps
]
Usage
Extended management commands: - makemigrations - migrate - squashmigrations
makemigrations
# generate data migration file
./manage.py makemigrations --data-only [app_name]
# generate data migration file with readable name "name_change"
./manage.py makemigrations --data-only [app_name] name_change
# generate empty file
./manage.py makemigrations --data-only [app_name] --empty
# generate without fileheader
./manage.py makemigrations --data-only [app_name] --no-header
The makemigrations command generates a file [app_name]/data_migrations/[id]_[name].py with content like
class Node:
name = '0001_first'
dependencies = ()
migration_dependencies = ('testapp.0001_initial', )
routines = [
]
migrate
# apply data migration file ./manage.py migrate --data-only # revert complete data migration state ./manage.py migrate --data-only zero # revert partial data migration state ./manage.py migrate --data-only 0002_some_big_change
Development
To develop the package further set up a local environment using the provided ./dev-requirements.txt file.
To run the test suite and generate a coverage report run
coverage run -m pytest -v tests
coverage [html|report]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-data-migrations-0.0.3.tar.gz.
File metadata
- Download URL: django-data-migrations-0.0.3.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e638b53087709e2ce07eb1b511f8387ce6b21b9ce5252dc4428ca5d2056b319e
|
|
| MD5 |
0c091879ea836789473c2e01683d0247
|
|
| BLAKE2b-256 |
008f188d13632d7ac623248c255626e934838fef5f6e5d44a0531e5e85c561e1
|
File details
Details for the file django_data_migrations-0.0.3-py3-none-any.whl.
File metadata
- Download URL: django_data_migrations-0.0.3-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db7d511757c5df696d377e169d3b284aae124c173db107aac066b74a7360d4b7
|
|
| MD5 |
f99ae2817947b59015ec7298fd06d0b1
|
|
| BLAKE2b-256 |
16112c8d39272cd21b0f5107cb138b5ca2501ca8decd21038dbc465193b57724
|