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.
Metadata
Release files for django-migration-cleaner 1.0.4
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_migration_cleaner-1.0.4.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_migration_cleaner-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / django_migration_cleaner-1.0.4.tar.gz
| Download URL | django_migration_cleaner-1.0.4.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c0cd75f113d1cd4d115c0317de18d38a78eb9f57a38fe786053bbaa70472a13
|
|
BLAKE2b-256 checksum How to use checksums |
609b25d5c61ee7a0dec9b47c22d8fc41ba702c9431a8de2fc0932c40ffcd26d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / django_migration_cleaner-1.0.4-py3-none-any.whl
| Download URL | django_migration_cleaner-1.0.4-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
58cf02d811221df9f313d8ffae2c432ab930bb70134657fe95a926763140aba9
|
|
BLAKE2b-256 checksum How to use checksums |
7ca8c18bf436598b7fb31551a93c40d0189ef0cc55dde668d851f30c0eb9e087
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|