2021-09-09 00:36:08 +02:00
|
|
|
# Generated by Django 3.2.6 on 2021-09-08 22:35
|
|
|
|
|
2021-09-09 18:21:18 +02:00
|
|
|
from django.conf import settings
|
2021-09-09 00:36:08 +02:00
|
|
|
from django.db import migrations, models
|
2022-05-27 23:33:51 +02:00
|
|
|
from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor
|
2021-09-09 18:21:18 +02:00
|
|
|
from django.db.migrations.state import StateApps
|
|
|
|
|
|
|
|
|
2022-05-27 23:33:51 +02:00
|
|
|
def rename_system_bot_realm(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None:
|
2021-09-09 18:21:18 +02:00
|
|
|
# Prior to this migration, the system bot realm had name incorrectly set to null.
|
|
|
|
Realm = apps.get_model("zerver", "Realm")
|
|
|
|
Realm.objects.filter(name=None, string_id=settings.SYSTEM_BOT_REALM).update(
|
|
|
|
name="System bot realm"
|
|
|
|
)
|
2021-09-09 00:36:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
2021-09-09 18:21:18 +02:00
|
|
|
atomic = False
|
2021-09-09 00:36:08 +02:00
|
|
|
|
|
|
|
dependencies = [
|
|
|
|
("zerver", "0344_alter_emojiset_default_value"),
|
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
2021-09-09 18:21:18 +02:00
|
|
|
migrations.RunPython(
|
|
|
|
rename_system_bot_realm,
|
|
|
|
reverse_code=migrations.RunPython.noop,
|
|
|
|
elidable=True,
|
|
|
|
),
|
2021-09-09 00:36:08 +02:00
|
|
|
migrations.AlterField(
|
|
|
|
model_name="realm",
|
|
|
|
name="name",
|
|
|
|
field=models.CharField(max_length=40),
|
|
|
|
),
|
|
|
|
]
|