From 0df4824fd45ae53cac97bbb1e67c469bcf06e257 Mon Sep 17 00:00:00 2001 From: Marc 'risson' Schmitt Date: Thu, 24 Apr 2025 13:20:37 +0200 Subject: [PATCH] lifecycle/migrate: fix migration failing if killed during first startup (#14207) Co-authored-by: Taylor Jones --- lifecycle/system_migrations/tenant_to_brand.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lifecycle/system_migrations/tenant_to_brand.py b/lifecycle/system_migrations/tenant_to_brand.py index 7a9da6f741..a873b2f384 100644 --- a/lifecycle/system_migrations/tenant_to_brand.py +++ b/lifecycle/system_migrations/tenant_to_brand.py @@ -3,7 +3,7 @@ from lifecycle.migrate import BaseMigration SQL_STATEMENT = """ BEGIN TRANSACTION; -ALTER TABLE authentik_tenants_tenant RENAME TO authentik_brands_brand; +ALTER TABLE IF EXISTS authentik_tenants_tenant RENAME TO authentik_brands_brand; UPDATE django_migrations SET app = replace(app, 'authentik_tenants', 'authentik_brands'); UPDATE django_content_type SET app_label = replace(app_label, 'authentik_tenants', 'authentik_brands'); COMMIT;