Files
zulip/zerver/migrations/0639_zh_hant_tw_rename.py
Alex Vandiver 06d04b4291 migrations: Change migration 0639's dependency for backporting to 9.x.
This moves it "earlier" in the migrations graph, onto the last
migration in 9.x, and adds a merge migration to fold it back into
main's current migrations tip.
2024-12-11 12:21:25 -08:00

32 lines
1.1 KiB
Python

# 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,
)
]