migrations: Index MutedTopic on stream/topic.

This index lets us quickly find all users who may be muting
a topic, which useful when we send messages out.
This commit is contained in:
Steve Howell 2017-10-23 16:52:02 -07:00 committed by Tim Abbott
parent 0263c857b3
commit 0164cfdf5c

View File

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('zerver', '0111_botuserstatedata'),
]
operations = [
migrations.RunSQL(
'''
CREATE INDEX zerver_mutedtopic_stream_topic
ON zerver_mutedtopic
(stream_id, upper(topic_name))
''',
reverse_sql='DROP INDEX zerver_mutedtopic_stream_topic;'
),
]