mirror of https://github.com/zulip/zulip.git
initialize_voyager_db: Do nothing if a realm already exists.
This should help avoid confusing error messages for anyone accidentally running this twice. In particular, this also makes it easier to run Zulip inside Kubernetes, since one doesn't need to worry about duplicate calls.
This commit is contained in:
parent
104fdd8bf9
commit
d4119d0198
|
@ -30,6 +30,9 @@ class Command(BaseCommand):
|
||||||
help='The number of extra users to create')
|
help='The number of extra users to create')
|
||||||
|
|
||||||
def handle(self, *args: Any, **options: Any) -> None:
|
def handle(self, *args: Any, **options: Any) -> None:
|
||||||
|
if Realm.objects.count() > 0:
|
||||||
|
print("Database already initialized; doing nothing.")
|
||||||
|
return
|
||||||
realm = Realm.objects.create(string_id=settings.INTERNAL_BOT_DOMAIN.split('.')[0])
|
realm = Realm.objects.create(string_id=settings.INTERNAL_BOT_DOMAIN.split('.')[0])
|
||||||
|
|
||||||
names = [(settings.FEEDBACK_BOT_NAME, settings.FEEDBACK_BOT)]
|
names = [(settings.FEEDBACK_BOT_NAME, settings.FEEDBACK_BOT)]
|
||||||
|
|
Loading…
Reference in New Issue