Open apekatten opened 7 years ago
I have this issue as well. The error shown is;
django.db.utils.ProgrammingError: relation "openinghours_company" does not exist
when running python manage.py migrate openinghours
My migrations fail like this:
Traceback (most recent call last):
File "./manage.py", line 8, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 189, in handle
pre_migrate_state = executor._create_project_state(with_applied_migrations=True)
File "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 79, in _create_project_state
migration.mutate_state(state, preserve=False)
File "/usr/local/lib/python3.7/site-packages/django/db/migrations/migration.py", line 87, in mutate_state
operation.state_forwards(self.app_label, new_state)
File "/usr/local/lib/python3.7/site-packages/django/db/migrations/operations/fields.py", line 229, in state_forwards
state.models[app_label, self.model_name_lower].fields
KeyError: ('openinghours', 'company')
I introduced the OPENINGHOURS_PREMISES_MODEL and back then the migrations worked I think, grumble, grumble.
@imposeren I see swappable is undocumented now for just over 7 years https://code.djangoproject.com/ticket/19103 could this save us https://github.com/wq/django-swappable-models