mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
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:
@@ -1,6 +1,7 @@
|
|||||||
from typing import Iterable, Optional, Tuple
|
from typing import Iterable, Optional, Tuple
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.db import transaction
|
||||||
|
|
||||||
from zerver.lib.bulk_create import bulk_create_users
|
from zerver.lib.bulk_create import bulk_create_users
|
||||||
from zerver.lib.user_groups import create_system_user_groups_for_realm
|
from zerver.lib.user_groups import create_system_user_groups_for_realm
|
||||||
@@ -20,6 +21,7 @@ def server_initialized() -> bool:
|
|||||||
return Realm.objects.exists()
|
return Realm.objects.exists()
|
||||||
|
|
||||||
|
|
||||||
|
@transaction.atomic(durable=True)
|
||||||
def create_internal_realm() -> None:
|
def create_internal_realm() -> None:
|
||||||
from zerver.actions.users import do_change_can_forge_sender
|
from zerver.actions.users import do_change_can_forge_sender
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user