Home > database >  How to erase/delete/wipe the migration history in Django
How to erase/delete/wipe the migration history in Django

Time:10-11

I'm experimenting with varios django modells and settings.

I can't erase the migration history which is make me upset.

I have run this script and physically delete all .pyc files and the database.

del /s /q *.pyc
del /q db.sqlite3

After I typed:

python manage.py makemigrations

and I got this:

No changes detected

I tired this as well:

python manage.py migrate --fake-initial

no luck.

Obviously I have tried to delete all files under migrations folder even I deleted that folders as well.

CodePudding user response:

With

del /q db.sqlite3

you've deleted your database (and all of the applied migrations there), which is all dandy, but the migrations themselves remain as Python files on disk (in <app>/migrations/*.py).

The

No changes detected

you get when you run makemigrations means there are no new migration files that would need to be created.

If you really want to get rid of all migrations, i.e. all of the history of your how models have evolved, you will also need to delete the migration script files under your apps' migrations/ folders.

  • Related