migrations: Fix system bot realm not having a name.

This prevented migration 0345
(517c2ed39d / #19696) from applying on
systems that were created after the refactoring that resulted in the
system bot realm potentially having null as its name.

(We've already confirmed that normal realms, created via
`do_create_realm`, shouldn't be able to have this unusual state).
This commit is contained in:
Tim Abbott
2021-09-09 09:21:18 -07:00
parent 545911b051
commit c5261af2dc
2 changed files with 18 additions and 1 deletions

View File

@@ -13,7 +13,7 @@ def server_initialized() -> bool:
def create_internal_realm() -> None:
from zerver.lib.actions import do_change_can_forge_sender
realm = Realm.objects.create(string_id=settings.SYSTEM_BOT_REALM)
realm = Realm.objects.create(string_id=settings.SYSTEM_BOT_REALM, name="System bot realm")
RealmAuditLog.objects.create(
realm=realm, event_type=RealmAuditLog.REALM_CREATED, event_time=realm.date_created
)