'How could I run makemigrations without errors in django
I am using (learning) python/django programming using Eclipse editor. I recently deleted migration files (manually selecting through editor) in migrations folder except init.py file since it was giving some errors with field names that I deleted before. I physically deleted those files. Now when I run makemigrations, it says the dependency files can not be located.
Part of error :
...raise NodeNotFoundError (self.error_message, self.key, origin=self.origin) django.db.migrations.excemption.NOdeNotFoundError: Migration login.0007_auto_20170512_2502 dependancies reference nonexistant parent node ('login','0006_auto_20170515_2226')
Can someone let me know how I could reconstruct the migration files?
Solution 1:[1]
Next time when you rollback:
Go into the migrations folder in your app.
Look for the migration file where you would like to go back to. (for example 0012_post_category.py)
go in the terminal write: ./manage.py migrate yourAppName 0012 (this is just an example number) and hit enter
if everything goes well. Delete the other migrations which came after this number in your migrations folder.
Do not just delete migrations! Hope that helps.
Solution 2:[2]
- on your app go to migrations folder
- find the migrations file 0012_post_category.py
- delete the file
- run python manage.py migrate
I had a similar problem and this process worked for me, i hope it works for you too
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | hansTheFranz |
| Solution 2 | Precious Ifada |
