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.
This commit is contained in:
Tim Abbott
2018-08-01 16:06:14 -07:00
parent c775be8ea4
commit 35cb7528f9
5 changed files with 52 additions and 3 deletions

View File

@@ -96,6 +96,14 @@ def create_indexes() -> None:
where_clause='WHERE (flags & 2048) != 0',
)
# copied from 0180
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',
)
class Command(ZulipBaseCommand):
help = """Create concurrent indexes for large tables."""