django-data-migration
Missing migration?
/ \
yes, migrate no, continue
\ /
restart app with new code
Installation
Install package:
INSTALLED_APPS = [
# django apps
'data_migration',
# your apps
]
Configuration
DATA_MIGRATION = {}
setting.
Currently supported attributes:
SQUASHABLE_APPS: a list of app(-label) names which allow squashing, you should only provide your own apps here
Usage
Extended management commands: - makemigrations - migrate - squashmigrations - data_migrate
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
squashmigrations
# regular squashing of test_app migrations 0001-0015
./manage.py squashmigrations test_app 0001 0015
# squash and replace test_app migrations 0001-0015 and extract data_migrations
./manage.py squashmigrations --extract-data-migrations test_app 0001 0015
data_migrate
# squash and replace all migrations at once
./manage.py data_migrate --all
# squash and replace migrations app-wise
./manage.py data_migrate test_app
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]
Metadata
Release files for django-data-migrations 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-data-migrations-0.1.5.tar.gz | 15.4 kB | Without provenance | Details for django-data-migrations-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_data_migrations-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for django_data_migrations-0.1.5-py3-none-any.whl |
Total release size: 34.6 kB
Release files / django-data-migrations-0.1.5.tar.gz
| Download URL | django-data-migrations-0.1.5.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
246cd037d2d19b83c6a2da7e5207eeeec8a139a0e70b6b9ba54bc9cdf38f0a8a
|
|
BLAKE2b-256 checksum How to use checksums |
1ca4e36210c3f4c4b87dd5811f8edf73abd194df7020c91cc1ebad4dddebdeed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / django_data_migrations-0.1.5-py3-none-any.whl
| Download URL | django_data_migrations-0.1.5-py3-none-any.whl |
|---|---|
| Size | 19.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d97f18946ae69188155b7923c3396de88d2575dc17b99981746dbec8d52a5b18
|
|
BLAKE2b-256 checksum How to use checksums |
7094eb0dda3cae6955c083b9fb4219651d0eacea55937e5c94ea7d098f6ab7f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for django-data-migrations 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.