Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
migrations: Define emoji_to_lowercase outside.
Zixuan James Li4e240b880ee1
diff --git a/zerver/migrations/0081_make_emoji_lowercase.py b/zerver/migrations/0081_make_emoji_lowercase.pyindex 0d5532178ad..f0bcc47ae7d 100644--- a/zerver/migrations/0081_make_emoji_lowercase.py+++ b/zerver/migrations/0081_make_emoji_lowercase.py@@ -5,23 +5,24 @@ from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditorfrom django.db.migrations.state import StateApps+def emoji_to_lowercase(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None:+ RealmEmoji = apps.get_model("zerver", "RealmEmoji")+ emoji = RealmEmoji.objects.all()+ for e in emoji:+ # Technically, this could create a conflict, but it's+ # exceedingly unlikely. If that happens, the sysadmin can+ # manually rename the conflicts with the manage.py shell+ # and then rerun the migration/upgrade.+ e.name = e.name.lower()+ e.save()++class Migration(migrations.Migration):dependencies = [("zerver", "0080_realm_description_length"),]- def emoji_to_lowercase(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None:- RealmEmoji = apps.get_model("zerver", "RealmEmoji")- emoji = RealmEmoji.objects.all()- for e in emoji:- # Technically, this could create a conflict, but it's- # exceedingly unlikely. If that happens, the sysadmin can- # manually rename the conflicts with the manage.py shell- # and then rerun the migration/upgrade.- e.name = e.name.lower()- e.save()-operations = [migrations.RunPython(emoji_to_lowercase, elidable=True),migrations.AlterField(