diff --git a/authentik/providers/proxy/migrations/0001_squashed_0014_proxy_v2.py b/authentik/providers/proxy/migrations/0001_squashed_0014_proxy_v2.py index b4bb365ce..618c79062 100644 --- a/authentik/providers/proxy/migrations/0001_squashed_0014_proxy_v2.py +++ b/authentik/providers/proxy/migrations/0001_squashed_0014_proxy_v2.py @@ -2,6 +2,7 @@ import django.db.models.deletion from django.apps.registry import Apps +from django.core.exceptions import FieldError from django.db import migrations, models from django.db.backends.base.schema import BaseDatabaseSchemaEditor @@ -14,9 +15,13 @@ def migrate_defaults(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): from authentik.providers.proxy.models import ProxyProvider db_alias = schema_editor.connection.alias - for provider in ProxyProvider.objects.using(db_alias).filter(jwt_alg=JWTAlgorithms.RS256): - provider.set_oauth_defaults() - provider.save() + try: + for provider in ProxyProvider.objects.using(db_alias).filter(jwt_alg=JWTAlgorithms.RS256): + provider.set_oauth_defaults() + provider.save() + except FieldError: + # If the jwt_alg field doesn't exist, just ignore this migration + pass def migrate_mode(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): diff --git a/authentik/providers/proxy/migrations/0014_proxy_v2.py b/authentik/providers/proxy/migrations/0014_proxy_v2.py index 3f31f8407..82be52982 100644 --- a/authentik/providers/proxy/migrations/0014_proxy_v2.py +++ b/authentik/providers/proxy/migrations/0014_proxy_v2.py @@ -1,6 +1,7 @@ # Generated by Django 3.2.6 on 2021-09-09 11:24 from django.apps.registry import Apps +from django.core.exceptions import FieldError from django.db import migrations from django.db.backends.base.schema import BaseDatabaseSchemaEditor @@ -10,9 +11,13 @@ def migrate_defaults(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): from authentik.providers.proxy.models import ProxyProvider db_alias = schema_editor.connection.alias - for provider in ProxyProvider.objects.using(db_alias).filter(jwt_alg=JWTAlgorithms.RS256): - provider.set_oauth_defaults() - provider.save() + try: + for provider in ProxyProvider.objects.using(db_alias).filter(jwt_alg=JWTAlgorithms.RS256): + provider.set_oauth_defaults() + provider.save() + except FieldError: + # If the jwt_alg field doesn't exist, just ignore this migration + pass class Migration(migrations.Migration):