PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, April 13, 2022

[FIXED] How could I run makemigrations without errors in django

 April 13, 2022     django, migration     No comments   

Issue

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

Next time when you rollback:

  1. Go into the migrations folder in your app.

  2. Look for the migration file where you would like to go back to. (for example 0012_post_category.py)

  3. go in the terminal write: ./manage.py migrate yourAppName 0012 (this is just an example number) and hit enter

  4. 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.



Answered By - hansTheFranz
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing