Skip to main content

A Django management command to delete migrations.

Project description

Django Migration Cleaner

Django Migration Cleaner is a Django management command that allows you to easily delete migration files for specified apps or for all apps within your Django project. This can be useful for cleaning up your project during development.

Features

  • Delete migration files for specified apps.
  • Delete migration files for all apps within the project.
  • Ensures built-in Django apps are not modified.

Installation

You can install Django Migration Cleaner via pip:

pip install django-migration-cleaner

Add django_migration_cleaner to your INSTALLED_APPS in your Django project's settings.py:

INSTALLED_APPS = [
    ...
    'django_migration_cleaner',
    ...
]

Usage

Delete Migrations for Specific Apps To delete migration files for specific apps, run the following command:

python manage.py delete_migrations app_name1 app_name2

Replace app_name1, app_name2, etc. with the names of the apps for which you want to delete the migration files.

Delete Last Migration of an app(s)

python manage.py delete_migrations app_name --last
python manage.py delete_migrations app_name1 app_name2 --last

Replace app_name1, app_name2, etc. with the names of the apps for which you want to delete the last migration file.

Delete Migrations for All Apps

To delete migration files for all apps within your Django project, run the following command:

python manage.py delete_migrations --all

Example

python manage.py delete_migrations myapp anotherapp

This will delete all migration files for myapp and anotherapp, except for the init.py files in their migration directories.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.
  • Steps to Contribute
  • Fork the repository.
  • Create your feature branch (git checkout -b feature/YourFeature).
  • Commit your changes (git commit -am 'Add some feature').
  • Push to the branch (git push origin feature/YourFeature).
  • Create a new Pull Request.
  • License

This project is licensed under the MIT License. See the LICENSE file for more details.

Acknowledgements

This project was inspired by the need to clean up migration files during Django project development.

Contact

For any questions or suggestions, feel free to open an issue or contact the project maintainer.

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_migration_cleaner-1.0.4.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

django_migration_cleaner-1.0.4-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file django_migration_cleaner-1.0.4.tar.gz.

File metadata

File hashes

Hashes for django_migration_cleaner-1.0.4.tar.gz
Algorithm Hash digest
SHA256 5c0cd75f113d1cd4d115c0317de18d38a78eb9f57a38fe786053bbaa70472a13
MD5 b15ba63d09188ab211abd77cdc93a4b7
BLAKE2b-256 609b25d5c61ee7a0dec9b47c22d8fc41ba702c9431a8de2fc0932c40ffcd26d3

See more details on using hashes here.

File details

Details for the file django_migration_cleaner-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for django_migration_cleaner-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 58cf02d811221df9f313d8ffae2c432ab930bb70134657fe95a926763140aba9
MD5 ffd90c00b6943bad0acc6c8143111565
BLAKE2b-256 7ca8c18bf436598b7fb31551a93c40d0189ef0cc55dde668d851f30c0eb9e087

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