Hello everyone,
I’m encountering an issue during migrations in a microservices application. The tables are already present in the database, and initially, I applied migrations without using a custom user model (by setting managed=False
in the model meta) for using other models.
I’ve come across examples suggesting to resolve the issue by deleting the database and migration files. However, I’m seeking an alternative solution that doesn’t require deleting the entire database.
packages/django/core/management/commands/migrate.py", line 302, in handle
pre_migrate_apps = pre_migrate_state.apps
File "/usr/local/lib/python3.9/site-packages/django/utils/functional.py", line 57, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.9/site-packages/django/db/migrations/state.py", line 566, in apps
return StateApps(self.real_apps, self.models)
File "/usr/local/lib/python3.9/site-packages/django/db/migrations/state.py", line 637, in __init__
raise ValueError("\n".join(error.msg for error in errors))
ValueError: The field admin.LogEntry.user was declared with a lazy reference to 'inspection.customuser', but app 'inspection' doesn't provide model 'customuser'.