Home > Software engineering >  I can't make migration back, after i deleted them in Django
I can't make migration back, after i deleted them in Django

Time:09-01

I am using Django with VSC. I got some problem with my database, so i did want to delete inside of migrations but by mistake i deleted directly folder of migrations. Anyway then i used the code;

python manage.py makemigrations 
python manage.py migrate --fake 

Then i got my migrations informations back. But the problem is, this time it didn't detect my own migrations. So when i click something have connection with database. I got a mistake like "No such table: MyMigrationsName" How can i fix it ?

CodePudding user response:

OP can create there a folder named migrations in the place OP deleted and an __init.py__ file inside of it.

Then, if possible, drop the current database and run

python manage.py makemigrations
python manage.py migrate

CodePudding user response:

Right now you can DROP database, delete all migration files, run makemigrations and create a new database with the new migration files.

Then never make the same mistake again.

  • Related