coddingtonbear / django-mailbox

Import mail from POP3, IMAP, local email mailboxes or directly from Postfix or Exim4 into your Django application automatically.
MIT License
357 stars 166 forks source link

Missing migration? #235

Closed modernNeo closed 4 years ago

modernNeo commented 4 years ago

tried to do a migration today and I got this error complaining about a non-existent migration 0007_auto_20200413_2129 but I do not see this migration under the migrations folder for the mailbox module. Was it a previous migration that had been removed? how can I resolve this issue?

2020-09-30 17:47:13 = WARNING - Traceback (most recent call last):

2020-09-30 17:47:13 = WARNING -   File "manage.py", line 22, in <module>

2020-09-30 17:47:13 = WARNING -     
2020-09-30 17:47:13 = WARNING - execute_from_command_line(sys.argv)
2020-09-30 17:47:13 = WARNING -   File "/home/csss/envCSSS/lib/python3.8/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line

2020-09-30 17:47:13 = WARNING -     
2020-09-30 17:47:13 = WARNING - utility.execute()
2020-09-30 17:47:13 = WARNING -   File "/home/csss/envCSSS/lib/python3.8/site-packages/django/core/management/__init__.py", line 375, in execute

2020-09-30 17:47:13 = WARNING -     
2020-09-30 17:47:13 = WARNING - self.fetch_command(subcommand).run_from_argv(self.argv)
2020-09-30 17:47:13 = WARNING -   File "/home/csss/envCSSS/lib/python3.8/site-packages/django/core/management/base.py", line 323, in run_from_argv

2020-09-30 17:47:13 = WARNING -     
2020-09-30 17:47:13 = WARNING - self.execute(*args, **cmd_options)
2020-09-30 17:47:13 = WARNING -   File "/home/csss/envCSSS/lib/python3.8/site-packages/django/core/management/base.py", line 364, in execute

2020-09-30 17:47:13 = WARNING -     
2020-09-30 17:47:13 = WARNING - output = self.handle(*args, **options)
2020-09-30 17:47:13 = WARNING -   File "/home/csss/envCSSS/lib/python3.8/site-packages/django/core/management/base.py", line 83, in wrapped

2020-09-30 17:47:13 = WARNING -     
2020-09-30 17:47:13 = WARNING - res = handle_func(*args, **kwargs)
2020-09-30 17:47:13 = WARNING -   File "/home/csss/envCSSS/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 87, in handle

2020-09-30 17:47:13 = WARNING -     
2020-09-30 17:47:13 = WARNING - executor = MigrationExecutor(connection, self.migration_progress_callback)
2020-09-30 17:47:13 = WARNING -   File "/home/csss/envCSSS/lib/python3.8/site-packages/django/db/migrations/executor.py", line 18, in __init__

2020-09-30 17:47:13 = WARNING -     
2020-09-30 17:47:13 = WARNING - self.loader = MigrationLoader(self.connection)
2020-09-30 17:47:13 = WARNING -   File "/home/csss/envCSSS/lib/python3.8/site-packages/django/db/migrations/loader.py", line 49, in __init__

2020-09-30 17:47:13 = WARNING -     
2020-09-30 17:47:13 = WARNING - self.build_graph()
2020-09-30 17:47:13 = WARNING -   File "/home/csss/envCSSS/lib/python3.8/site-packages/django/db/migrations/loader.py", line 274, in build_graph

2020-09-30 17:47:13 = WARNING -     
2020-09-30 17:47:13 = WARNING - raise exc
2020-09-30 17:47:13 = WARNING -   File "/home/csss/envCSSS/lib/python3.8/site-packages/django/db/migrations/loader.py", line 248, in build_graph

2020-09-30 17:47:13 = WARNING -     
2020-09-30 17:47:13 = WARNING - self.graph.validate_consistency()
2020-09-30 17:47:13 = WARNING -   File "/home/csss/envCSSS/lib/python3.8/site-packages/django/db/migrations/graph.py", line 195, in validate_consistency

2020-09-30 17:47:13 = WARNING -     
2020-09-30 17:47:13 = WARNING - [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
2020-09-30 17:47:13 = WARNING -   File "/home/csss/envCSSS/lib/python3.8/site-packages/django/db/migrations/graph.py", line 195, in <listcomp>

2020-09-30 17:47:13 = WARNING -     
2020-09-30 17:47:13 = WARNING - [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
2020-09-30 17:47:13 = WARNING -   File "/home/csss/envCSSS/lib/python3.8/site-packages/django/db/migrations/graph.py", line 58, in raise_error

2020-09-30 17:47:13 = WARNING -     
2020-09-30 17:47:13 = WARNING - raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
2020-09-30 17:47:13 = WARNING - django.db.migrations.exceptions
2020-09-30 17:47:13 = WARNING - .
2020-09-30 17:47:13 = WARNING - NodeNotFoundError
2020-09-30 17:47:13 = WARNING - : 
2020-09-30 17:47:13 = WARNING - Migration announcements.0002_auto_20200925_1820 dependencies reference nonexistent parent node ('django_mailbox', '0007_auto_20200413_2129')
coddingtonbear commented 4 years ago

Doesn't look likely given that we've had a 0007 migration since ~2018 and there's no occurrence of the string 0007_auto_20200413_2129 in the codebase's history. I'm afraid I don't know what direction to give you, but I can say with some confidence that it doesn't look like the answer is that we've deleted a migration here.

modernNeo commented 4 years ago

I think I sorta figured out the issue.

for reasons beyond me [since I am not advanced enough a django/python developer to say], if someone installs django_mailbox versions 4.7.0<=x<=4.8.0, running makemigrations results in local django_mailbox migrations being made in addition to the ones that comes with the module.

I was not aware previously that I should never be making my own migrations of third-party modules so I did not question it before but now that I learned the proper process, that presented a problem. just upping to latest version seems to solve it however.