Files
zulip/zerver/migrations/0323_show_starred_message_counts.py
m-e-l-u-h-a-n 201dd7507f left-sidebar: Show starred message counts by default.
It is changed just to make this feature more discoverable.

Fixes: #18305.
2021-05-01 07:27:08 -07:00

33 lines
1.0 KiB
Python

# Generated by Django 3.1.8 on 2021-05-01 12:34
from django.db import migrations, models
from django.db.backends.postgresql.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
# Set starred_message_count for already existing users to True.
def set_starred_message_count_to_true(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
UserProfile = apps.get_model("zerver", "UserProfile")
UserProfile.objects.filter(starred_message_counts=False).update(starred_message_counts=True)
class Migration(migrations.Migration):
atomic = False
dependencies = [
("zerver", "0322_realm_create_audit_log_backfill"),
]
operations = [
migrations.AlterField(
model_name="userprofile",
name="starred_message_counts",
field=models.BooleanField(default=True),
),
migrations.RunPython(
set_starred_message_count_to_true,
reverse_code=migrations.RunPython.noop,
elidable=True,
),
]