Files
zulip/zerver/migrations/0180_usermessage_add_active_mobile_push_notification.py
Tim Abbott 35cb7528f9 models: Add new UserMessage flag active_mobile_push_notification.
This flag is used to track which user/message pairs correspond to an
active mobile push notification, that should potentially be cleared
when the user reads the message.

This flag should never appear on a message that is also marked as
read; eventually we may want a cron job to check for that condition.

We include a partial index on UserMessage for this flag.
2018-08-01 16:51:56 -07:00

37 lines
1.6 KiB
Python

# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-08-01 23:05
from __future__ import unicode_literals
import bitfield.models
from django.db import migrations
from zerver.lib.migrate import create_index_if_not_exist # nolint
class Migration(migrations.Migration):
dependencies = [
('zerver', '0179_rename_to_digest_emails_enabled'),
]
operations = [
migrations.AlterField(
model_name='archivedusermessage',
name='flags',
field=bitfield.models.BitField(['read', 'starred', 'collapsed', 'mentioned', 'wildcard_mentioned', 'summarize_in_home', 'summarize_in_stream', 'force_expand', 'force_collapse', 'has_alert_word', 'historical', 'is_private', 'active_mobile_push_notification'], default=0),
),
migrations.AlterField(
model_name='usermessage',
name='flags',
field=bitfield.models.BitField(['read', 'starred', 'collapsed', 'mentioned', 'wildcard_mentioned', 'summarize_in_home', 'summarize_in_stream', 'force_expand', 'force_collapse', 'has_alert_word', 'historical', 'is_private', 'active_mobile_push_notification'], default=0),
),
migrations.RunSQL(
create_index_if_not_exist(
index_name='zerver_usermessage_active_mobile_push_notification_id',
table_name='zerver_usermessage',
column_string='user_profile_id, message_id',
where_clause='WHERE (flags & 4096) != 0',
),
reverse_sql='DROP INDEX zerver_usermessage_active_mobile_push_notification_id;'
),
]