diff --git a/simplex-chat.cabal b/simplex-chat.cabal index fbd1d222e6..cf9b71cba1 100644 --- a/simplex-chat.cabal +++ b/simplex-chat.cabal @@ -148,6 +148,7 @@ library Simplex.Chat.Migrations.M20240528_quota_err_counter Simplex.Chat.Migrations.M20240827_calls_uuid Simplex.Chat.Migrations.M20240920_user_order + Simplex.Chat.Migrations.M20241008_indexes Simplex.Chat.Mobile Simplex.Chat.Mobile.File Simplex.Chat.Mobile.Shared diff --git a/src/Simplex/Chat/Migrations/M20241008_indexes.hs b/src/Simplex/Chat/Migrations/M20241008_indexes.hs new file mode 100644 index 0000000000..94cffa8d74 --- /dev/null +++ b/src/Simplex/Chat/Migrations/M20241008_indexes.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE QuasiQuotes #-} + +module Simplex.Chat.Migrations.M20241008_indexes where + +import Database.SQLite.Simple (Query) +import Database.SQLite.Simple.QQ (sql) + +m20241008_indexes :: Query +m20241008_indexes = + [sql| +CREATE INDEX idx_received_probes_group_member_id on received_probes(group_member_id); +|] + +down_m20241008_indexes :: Query +down_m20241008_indexes = + [sql| +DROP INDEX idx_received_probes_group_member_id; +|] diff --git a/src/Simplex/Chat/Migrations/chat_schema.sql b/src/Simplex/Chat/Migrations/chat_schema.sql index 214c0e72cc..ad13fb5db9 100644 --- a/src/Simplex/Chat/Migrations/chat_schema.sql +++ b/src/Simplex/Chat/Migrations/chat_schema.sql @@ -885,3 +885,6 @@ CREATE INDEX idx_chat_items_fwd_from_group_id ON chat_items(fwd_from_group_id); CREATE INDEX idx_chat_items_fwd_from_chat_item_id ON chat_items( fwd_from_chat_item_id ); +CREATE INDEX idx_received_probes_group_member_id on received_probes( + group_member_id +); diff --git a/src/Simplex/Chat/Store/Migrations.hs b/src/Simplex/Chat/Store/Migrations.hs index a09baee272..a546b1851a 100644 --- a/src/Simplex/Chat/Store/Migrations.hs +++ b/src/Simplex/Chat/Store/Migrations.hs @@ -112,6 +112,7 @@ import Simplex.Chat.Migrations.M20240515_rcv_files_user_approved_relays import Simplex.Chat.Migrations.M20240528_quota_err_counter import Simplex.Chat.Migrations.M20240827_calls_uuid import Simplex.Chat.Migrations.M20240920_user_order +import Simplex.Chat.Migrations.M20241008_indexes import Simplex.Messaging.Agent.Store.SQLite.Migrations (Migration (..)) schemaMigrations :: [(String, Query, Maybe Query)] @@ -223,7 +224,8 @@ schemaMigrations = ("20240515_rcv_files_user_approved_relays", m20240515_rcv_files_user_approved_relays, Just down_m20240515_rcv_files_user_approved_relays), ("20240528_quota_err_counter", m20240528_quota_err_counter, Just down_m20240528_quota_err_counter), ("20240827_calls_uuid", m20240827_calls_uuid, Just down_m20240827_calls_uuid), - ("20240920_user_order", m20240920_user_order, Just down_m20240920_user_order) + ("20240920_user_order", m20240920_user_order, Just down_m20240920_user_order), + ("20241008_indexes", m20241008_indexes, Just down_m20241008_indexes) ] -- | The list of migrations in ascending order by date