Skip to main content

Django management commands for project-wide (editable) migrations.

Project description

License Build Status Coverage

Django management commands for project-wide (editable) migrations.


The django-migrate-project app aims to add management commands to make running full project migrations more sane and controllable. The concept is pretty simple: first collect any unapplied migrations into per-app migration files, then review and modify as need be, and finally apply the migrations.

By staging and consolidating unapplied migrations in a way that they can be edited and reviewed before applying, more confidence is gained that a rogue migration won’t damage production tables. The collected and consolidated migrations are listed as replacements for the individual app migrations they represent so once they have been applied everything is in the same state as if the individual app migrations has been applied via ‘migrate’.


Requires Django 1.7+ and as such Python 2.7+ as well


Simply use pip to install:

$ pip install django-migrate-project

To be of any use django-migrate-project must be added to the Django project via INSTALLED_APPS in the project file:



Two new management commands provide the core functionality. To gather up any unapplied migrations for the project simply run:

$ python collectmigrations

The default collection location is BASE_DIR/migrations. If the project’s does not have a BASE_DIR then a directory path must be provided using the --output-dir option.

The collected migrations are grouped per-app and have the filename format of <app_label> These files can be edited to taste in order to change the migration, the only important bit is to keep the replaces and dependencies fields in the migration the same, as those allow the bookkeeping to be kept accurate.

Collected migrations are applied via:

$ python migrateproject

The default directory path is used again if possible, otherwise the path must be provided via the --input-dir option.

Finally, migrations can be unapplied easily as well, returning the migration state to what it was before by running:

$ python migrateproject --unapply


Contributions are welcome, just create a pull request or issue on the GitHub repository for the project.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-migrate-project, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size django_migrate_project-0.1.0-py2.py3-none-any.whl (10.9 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size django-migrate-project-0.1.0.tar.gz (7.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page