Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

migrations: Generate statistics for subject vs channel-messages.

Alex Vandiveraebc9081b86c
diff --git a/zerver/migrations/0695_is_channel_message_stats.py b/zerver/migrations/0695_is_channel_message_stats.py
new file mode 100644
index 00000000000..d18a875e905
--- /dev/null
+++ b/zerver/migrations/0695_is_channel_message_stats.py
@@ -0,0 +1,21 @@
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ atomic = False
+
+ dependencies = [
+ ("zerver", "0694_remove_message_unconditional_topic_indexes"),
+ ]
+
+ operations = [
+ migrations.RunSQL(
+ sql="CREATE STATISTICS IF NOT EXISTS zerver_message_subject_is_channel_message ON subject, is_channel_message FROM zerver_message",
+ reverse_sql="DROP STATISTICS IF EXISTS zerver_message_subject_is_channel_message",
+ ),
+ migrations.RunSQL(
+ sql="ALTER STATISTICS zerver_message_subject_is_channel_message SET STATISTICS 1500",
+ reverse_sql="ALTER STATISTICS zerver_message_subject_is_channel_message SET STATISTICS -1",
+ ),
+ migrations.RunSQL("ANALYZE zerver_message"),
+ ]