Django Migrate Fresh 🚀
A simple Django package that provides Laravel-style migrate:fresh functionality - drop all tables and re-run migrations with optional backup support.
Installation
pip install django-migrate-fresh
Add to your INSTALLED_APPS:
INSTALLED_APPS = [
# ... your other apps
'django_migrate_fresh',
]
Usage
Basic Usage
Drop all tables and re-run migrations:
python manage.py migrate_fresh
With Backup
Create a backup before running:
python manage.py migrate_fresh --backup
Specify backup path:
python manage.py migrate_fresh --backup --backup-path my_backup.sql
Force Mode (No Confirmations)
Skip all confirmations:
python manage.py migrate_fresh --force
Command Options
--force: Skip all confirmation prompts--backup: Create a backup before dropping tables--backup-path PATH: Specify custom backup file path
Interactive Mode
When run without --force, the command will ask:
- Backup confirmation: "Do you want to create a backup before proceeding?"
- Path input (if backup selected): Prompts for backup file path
- Final confirmation: "Are you sure you want to continue?"
Database Support
- PostgreSQL: Uses
pg_dumpfor backups - MySQL: Uses
mysqldumpfor backups - SQLite: Simple file copy for backups
Example Session
$ python manage.py migrate_fresh
🚀 Django Migrate Fresh
==================================================
💾 Do you want to create a backup before proceeding? [y/N]: y
📁 Enter backup path [backup_20231219_143022.sql]: my_backup.sql
⚠️ This will DROP ALL TABLES and re-run migrations.
🤔 Are you sure you want to continue? [y/N]: y
💾 Creating backup...
✅ Backup created: my_backup.sql
🔥 Dropping all tables...
🗑️ Dropped 15 tables
🏗️ Running migrations...
✨ Fresh migration completed!
✅ Migration completed successfully in 2.34 seconds!
Requirements
- Django >= 3.2
- Python >= 3.8
License
MIT License
Metadata
Release files for django-migrate-fresh 3.1.0
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 | |
|---|---|---|---|---|
| django_migrate_fresh-3.1.0.tar.gz | 16.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_migrate_fresh-3.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.2 kB
Release files / django_migrate_fresh-3.1.0.tar.gz
| Download URL | django_migrate_fresh-3.1.0.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5db296b2e3da74d2802de4247b54ed69479747e84bf76e2de77a62149cb71756
|
|
BLAKE2b-256 checksum How to use checksums |
58a0ec6ee35e3be26c5cc0aef6797df6b17b111393eb629a2a68dfb02a3ade73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / django_migrate_fresh-3.1.0-py3-none-any.whl
| Download URL | django_migrate_fresh-3.1.0-py3-none-any.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8b148153fc38797e6fdee65891443b1acdd4fe64bd12473eeef91c38cd146eb
|
|
BLAKE2b-256 checksum How to use checksums |
3257d4fd24e123840983d71502dcb048efd5d4a728c88decb9885fba26629b9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for django-migrate-fresh 3.1.0
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.