From 0164cfdf5c9ea2e76b27e4e996bad1acdf763135 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Mon, 23 Oct 2017 16:52:02 -0700 Subject: [PATCH] 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. --- zerver/migrations/0112_index_muted_topics.py | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 zerver/migrations/0112_index_muted_topics.py diff --git a/zerver/migrations/0112_index_muted_topics.py b/zerver/migrations/0112_index_muted_topics.py new file mode 100644 index 0000000000..b241a7a86b --- /dev/null +++ b/zerver/migrations/0112_index_muted_topics.py @@ -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;' + ), + ]