migration error after deleting app (NodeNotFoundError))

I had one application in project, and several models and migrations there, but I had to remove this application because of this app becomed unnecessary. Then I run server and got this problems with migrations: django.db.migrations.exceptions.NodeNotFoundError: Migration accounts.0025_rename_user_employee dependencies reference nonexistent parent node (‘kitchen5bot’, ‘0002_auto_20210605_0809’). Please, can anyone tell how to fix that?

Couple of different options, each with various potential issues. (Note, you could still have problems with things like the migrations table and the content type table.)

  • Delete all migrations and redo makemigrations

  • Edit the individual migration files to refer to the proper predecessor

  • (Safest route) Drop your database and rebuild from scratch

  • Recover your deleted app along with the migrations, delete the models in the app, do another makemigrations, then squash the migrations - hopefully that might remove all the intermediate steps.

Also see: Removing app in django 1.11, which references this blog post: Cleanly removing a Django app (with models)