Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

1.1 KB
Raw Blame
# Generated by Django 5.0.9 on 2024-12-10 15:49

from django.db import migrations
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.migrations.state import StateApps


def update_zh_hant_tw_language(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None:
    UserProfile = apps.get_model("zerver", "UserProfile")
    UserProfile.objects.filter(default_language="zh-hant").update(default_language="zh-tw")

    PreregistrationRealm = apps.get_model("zerver", "PreregistrationRealm")
    PreregistrationRealm.objects.filter(default_language="zh-hant").update(default_language="zh-tw")

    Realm = apps.get_model("zerver", "Realm")
    Realm.objects.filter(default_language="zh-hant").update(default_language="zh-tw")


class Migration(migrations.Migration):
    dependencies = [
        # The most recent 9.x migration, since this will be backported
        ("zerver", "0622_backfill_imageattachment_again"),
    ]

    operations = [
        migrations.RunPython(
            update_zh_hant_tw_language,
            elidable=True,
            reverse_code=migrations.RunPython.noop,
        )
    ]