django-keycloak icon indicating copy to clipboard operation
django-keycloak copied to clipboard

Cannot run migrations with RemoteUserOpenIdConnectProfile

Open bossan opened this issue 5 years ago • 8 comments

Running all migrations from an initial state using the RemoteUserOpenIdConnectProfile is unsuccessful.

The order of migrations 0001, 0002 and 0003 and dependencies on the OpenIdConnectProfile make it impossible to successfully run all migrations.

bossan avatar Jul 15 '19 09:07 bossan

I've this issue too when try to migrate using RemoteUserOpenIdConnectProfile and local user storage.

django.db.utils.ProgrammingError: relation "django_keycloak_openidconnectprofile" does not exist

Is there any workaround for this issue?

SpaceWhite avatar Aug 08 '19 11:08 SpaceWhite

I'm too ( @swist @bossan How you solved this issue? >6 month pass Because this problem raise docker container big issue

malinich avatar Mar 13 '20 08:03 malinich

@Malinich I forked the project and created new migrations.

bossan avatar Mar 21 '20 21:03 bossan

@bossan Will you be opening a PR for the new migrations?

riaanvddool avatar Apr 22 '20 16:04 riaanvddool

I'm still having this issue, I think it is because here the RemoteUserOpenIdConnectProfile.Meta is inheriting the abstract flag, and if you have KEYCLOAK_OIDC_PROFILE_MODEL = 'django_keycloak.RemoteUserOpenIdConnectProfile' set it will never create the django_keycloak_remoteuseropenidconnectprofile table.

Is there a specific reason why it needs to be abstract? if not I'll create a pull request.

pm-coelho avatar Aug 14 '20 14:08 pm-coelho

to repair the migrations, it would be interesting to reset and do the --fake-initial, that way it would solve without generating so many complications

dyohan9 avatar Nov 05 '20 15:11 dyohan9

I am also stuck on this issue, I get the following error when trying to run a migration: django.db.utils.ProgrammingError: relation "django_keycloak_openidconnectprofile" does not exist

bowerta avatar Nov 23 '20 19:11 bowerta

I was struggling with the same error, but I fixed it as below. Delete or comment on lines related to the 'remote user', and migrate again. After the migration, just roll back the lines, and it works.

# KEYCLOAK_OIDC_PROFILE_MODEL = "django_keycloak.RemoteUserOpenIdConnectProfile" # KEYCLOAK_REMOTE_USER_MODEL = "django_keycloak.remote_user.KeycloakRemoteUser" --> + middleware

0jinny avatar Jul 08 '21 04:07 0jinny