I use git in django for my project and my database is postgres. When I make a change in the file and make migrations and then migrate, it is correct and the database is correct.
But when I go back to the previous commit (git checkout
command) and then migrate, a new migration is created, but when I run command python manage.py migrate, it says "no changes were found". When I look at the database, I see that it has the same git checkout fields as before.
python manage.py makemigrations
Migrations for 'main_app':
main_app\migrations\0001_initial.py
- Create model Project
- Create model Resume
- Create model Experience
- Create model Comment
python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, main_app, sessions, users
Running migrations:
No migrations to apply.
I went through many ways, I deleted the migrations and created them again, but it didn't help, it still said that there is no change. Only when I delete the database and create it again, the migrate command works correctly. Deleting the database is dangerous.
Can you suggest another way and guide me?