fix migrations for template schema 3
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
parent
3b98b1e386
commit
89aa6539b2
|
@ -1,9 +1,13 @@
|
||||||
"""Tenant utils"""
|
"""Tenant utils"""
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
|
from django.db.utils import ProgrammingError
|
||||||
|
|
||||||
from authentik.tenants.models import Tenant
|
from authentik.tenants.models import Tenant
|
||||||
|
|
||||||
|
|
||||||
def get_current_tenant() -> Tenant | None:
|
def get_current_tenant() -> Tenant | None:
|
||||||
"""Get tenant for current request"""
|
"""Get tenant for current request"""
|
||||||
return Tenant.objects.filter(schema_name=connection.schema_name).first()
|
try:
|
||||||
|
return Tenant.objects.filter(schema_name=connection.schema_name).first()
|
||||||
|
except ProgrammingError: # We're inside a migration and this table doesn't exist yet
|
||||||
|
return None
|
||||||
|
|
Reference in New Issue