user_message: Rename unused flags and create an index.

This commit renames the two unused and historical bits of the
'fields' bitfield of the 'UserMessage' and 'ArchivedUserMessage'
tables.

* 'summarize_in_home' to 'topic_wildcard_mentioned'
* 'summarize_in_stream' to 'group_mentioned'

The 'group_mentioned' flag doesn't affect the feature,
but completing the work here helps to save future migration
and indexing efforts on the UserMessage table, as we plan to
use this flag in the future for group mentions.

The unused bits may have old data; we'll clear that in
a separate commit.

It creates the 'zerver_usermessage_any_mentioned_message_id'
index concurrently.
This commit is contained in:
Prakhar Pratyush
2023-10-19 13:47:09 +05:30
committed by Tim Abbott
parent 5a44a6624b
commit c37871ac3a
4 changed files with 106 additions and 79 deletions

View File

@@ -2277,7 +2277,7 @@ one or more new messages.
return body
class MigrationsTestCase(ZulipTestCase): # nocoverage
class MigrationsTestCase(ZulipTransactionTestCase): # nocoverage
"""
Test class for database migrations inspired by this blog post:
https://www.caktusgroup.com/blog/2016/02/02/writing-unit-tests-django-migrations/
@@ -2295,6 +2295,7 @@ class MigrationsTestCase(ZulipTestCase): # nocoverage
@override
def setUp(self) -> None:
super().setUp()
assert (
self.migrate_from and self.migrate_to
), f"TestCase '{type(self).__name__}' must define migrate_from and migrate_to properties"