Skip to content

Commit d970add

Browse files
committed
migrations: Change existing "(no topic)" to "general chat".
This adds a migration to update existing "(no topic)" objects to "general chat". Fixes zulip#23291.
1 parent bebb57f commit d970add

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Generated by Django 4.1.2 on 2022-11-01 12:55
2+
3+
from django.db import migrations
4+
from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor
5+
from django.db.migrations.state import StateApps
6+
7+
8+
def rename_no_topic_to_general_chat(
9+
apps: StateApps, schema_editor: BaseDatabaseSchemaEditor
10+
) -> None:
11+
Message = apps.get_model("zerver", "Message")
12+
Message.objects.filter(subject="(no topic)").update(subject="general chat")
13+
14+
15+
class Migration(migrations.Migration):
16+
atomic = False
17+
18+
dependencies = [
19+
("zerver", "0421_migrate_pronouns_custom_profile_fields"),
20+
]
21+
22+
operations = [
23+
migrations.RunPython(
24+
rename_no_topic_to_general_chat,
25+
reverse_code=migrations.RunPython.noop,
26+
elidable=True,
27+
),
28+
]

0 commit comments

Comments
 (0)