Reputation: 665
Unlike normal migrations, this is a different one. I have deleted the entire project and database. Used a basic Django project without any app in it. The error always points to my older migrations. To ensure I used default SQL lite.
Steps lead to this error: I tried adding columns to the Group Model using add_to_class
and contribute_to_class
methods. In the process of doing this, I lost track of the migration.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x000001E7701610D0>
Traceback (most recent call last):
File "E:\Python_365\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "E:\Python_365\lib\site-packages\django\core\management\commands\runserver.py", line 123, in inner_run
self.check_migrations()
File "E:\Python_365\lib\site-packages\django\core\management\base.py", line 427, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "E:\Python_365\lib\site-packages\django\db\migrations\executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "E:\Python_365\lib\site-packages\django\db\migrations\loader.py", line 49, in __init__
self.build_graph()
File "E:\Python_365\lib\site-packages\django\db\migrations\loader.py", line 267, in build_graph
raise exc
File "E:\Python_365\lib\site-packages\django\db\migrations\loader.py", line 241, in build_graph
self.graph.validate_consistency()
File "E:\Python_365\lib\site-packages\django\db\migrations\graph.py", line 243, in validate_consistency
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "E:\Python_365\lib\site-packages\django\db\migrations\graph.py", line 243, in <listcomp>
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "E:\Python_365\lib\site-packages\django\db\migrations\graph.py", line 96, in raise_error
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration auth.0022_group_openid dependencies reference nonexistent parent node ('Task', '0003_auto_20181107_1811')
I am not sure why Django is still referring to my migration which of other projects. This is not letting me migrate my other project as well, getting the same error everywhere.
Upvotes: 0
Views: 5425
Reputation: 309089
It sounds like the 0022_group_openid
migration file is in the django installation, not your project, and that you are using the same installation for multiple projects. You could remove the extra migration file(s) manually. It's good practice to use a different virtualenv for each project and install Django there.
You might want to look at the MIGRATION_MODULES
settings. It would allow you to put the migrations for django.contrib.auth
in your project, so that you could keep them under version control.
Finally, adding fields to the Group
model is unusual, so you might hit odd behaviour. I would try to avoid doing it if possible. Perhaps you could add a separate model with a foreign key or one-to-one field to Group
.
Upvotes: 1