feat: Add script to ensure public tenant and its domain exist.

This commit is contained in:
2025-12-18 00:59:37 +03:00
parent 7b32cdcebf
commit 6c72126276
3 changed files with 69 additions and 60 deletions

View File

@@ -49,12 +49,13 @@ def ensure_public_tenant():
print(f"WARNING: Domain {domain_name} is assigned to another tenant!")
# 3. Init system data (System Customer, etc.)
print("Initializing system data for public tenant...")
from django.core.management import call_command
try:
call_command('init_tenant_data', schema='public')
except Exception as e:
print(f"Error initializing system data: {e}")
# SKIP for public tenant as it doesn't have these tables (they separate in tenant schemas)
# print("Initializing system data for public tenant...")
# from django.core.management import call_command
# try:
# call_command('init_tenant_data', schema='public')
# except Exception as e:
# print(f"Error initializing system data: {e}")
if __name__ == '__main__':
ensure_public_tenant()