internal_realm: Single transaction for changes while creating realm.

This commit makes the database changes while creating internal_realm
to be done in a single transaction.
This is needed for deferring the foreign key constraints
to the end of transaction.
This commit is contained in:
Ujjawal Modi 2023-06-07 17:41:31 +05:30 committed by Tim Abbott
parent 1e9bb82068
commit 72b099524d
1 changed files with 2 additions and 0 deletions

View File

@ -1,6 +1,7 @@
from typing import Iterable, Optional, Tuple
from django.conf import settings
from django.db import transaction
from zerver.lib.bulk_create import bulk_create_users
from zerver.lib.user_groups import create_system_user_groups_for_realm
@ -20,6 +21,7 @@ def server_initialized() -> bool:
return Realm.objects.exists()
@transaction.atomic(durable=True)
def create_internal_realm() -> None:
from zerver.actions.users import do_change_can_forge_sender