mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-06-03 23:31:49 +00:00
Merge branch 'master' into chat-relays
This commit is contained in:
@@ -24,7 +24,8 @@ import Simplex.Chat.Store.Postgres.Migrations.M20251017_chat_tags_cascade
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20251117_member_relations_vector
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20251128_migrate_member_relations
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20251230_strict_tables
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260106_chat_relays
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260108_chat_indices
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260109_chat_relays
|
||||
import Simplex.Messaging.Agent.Store.Shared (Migration (..))
|
||||
|
||||
schemaMigrations :: [(String, Text, Maybe Text)]
|
||||
@@ -49,7 +50,8 @@ schemaMigrations =
|
||||
("20251117_member_relations_vector", m20251117_member_relations_vector, Just down_m20251117_member_relations_vector),
|
||||
("20251128_migrate_member_relations", m20251128_migrate_member_relations, Just down_m20251128_migrate_member_relations),
|
||||
("20251230_strict_tables", m20251230_strict_tables, Just down_m20251230_strict_tables),
|
||||
("20260106_chat_relays", m20260106_chat_relays, Just down_m20260106_chat_relays)
|
||||
("20260108_chat_indices", m20260108_chat_indices, Just down_m20260108_chat_indices),
|
||||
("20260109_chat_relays", m20260109_chat_relays, Just down_m20260109_chat_relays)
|
||||
]
|
||||
|
||||
-- | The list of migrations in ascending order by date
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Store.Postgres.Migrations.M20260108_chat_indices where
|
||||
|
||||
import Data.Text (Text)
|
||||
import Text.RawString.QQ (r)
|
||||
|
||||
m20260108_chat_indices :: Text
|
||||
m20260108_chat_indices =
|
||||
[r|
|
||||
CREATE INDEX idx_chat_items_contacts_msg_content_tag_created_at ON chat_items(
|
||||
user_id,
|
||||
contact_id,
|
||||
msg_content_tag,
|
||||
created_at
|
||||
);
|
||||
|
||||
CREATE INDEX idx_chat_items_note_folder_msg_content_tag_created_at ON chat_items(
|
||||
user_id,
|
||||
note_folder_id,
|
||||
msg_content_tag,
|
||||
created_at
|
||||
);
|
||||
|]
|
||||
|
||||
down_m20260108_chat_indices :: Text
|
||||
down_m20260108_chat_indices =
|
||||
[r|
|
||||
DROP INDEX idx_chat_items_contacts_msg_content_tag_created_at;
|
||||
|
||||
DROP INDEX idx_chat_items_note_folder_msg_content_tag_created_at;
|
||||
|]
|
||||
+5
-5
@@ -1,13 +1,13 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Store.Postgres.Migrations.M20260106_chat_relays where
|
||||
module Simplex.Chat.Store.Postgres.Migrations.M20260109_chat_relays where
|
||||
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Text.RawString.QQ (r)
|
||||
|
||||
m20260106_chat_relays :: Text
|
||||
m20260106_chat_relays =
|
||||
m20260109_chat_relays :: Text
|
||||
m20260109_chat_relays =
|
||||
T.pack
|
||||
[r|
|
||||
CREATE TABLE chat_relays(
|
||||
@@ -32,8 +32,8 @@ ALTER TABLE users ADD COLUMN is_user_chat_relay SMALLINT NOT NULL DEFAULT 0;
|
||||
ALTER TABLE group_members ADD COLUMN is_chat_relay SMALLINT NOT NULL DEFAULT 0;
|
||||
|]
|
||||
|
||||
down_m20260106_chat_relays :: Text
|
||||
down_m20260106_chat_relays =
|
||||
down_m20260109_chat_relays :: Text
|
||||
down_m20260109_chat_relays =
|
||||
T.pack
|
||||
[r|
|
||||
ALTER TABLE group_members DROP COLUMN is_chat_relay;
|
||||
@@ -1856,6 +1856,10 @@ CREATE INDEX idx_chat_items_contacts_created_at ON test_chat_schema.chat_items U
|
||||
|
||||
|
||||
|
||||
CREATE INDEX idx_chat_items_contacts_msg_content_tag_created_at ON test_chat_schema.chat_items USING btree (user_id, contact_id, msg_content_tag, created_at);
|
||||
|
||||
|
||||
|
||||
CREATE UNIQUE INDEX idx_chat_items_direct_shared_msg_id ON test_chat_schema.chat_items USING btree (user_id, contact_id, shared_msg_id);
|
||||
|
||||
|
||||
@@ -1940,6 +1944,10 @@ CREATE INDEX idx_chat_items_item_status ON test_chat_schema.chat_items USING btr
|
||||
|
||||
|
||||
|
||||
CREATE INDEX idx_chat_items_note_folder_msg_content_tag_created_at ON test_chat_schema.chat_items USING btree (user_id, note_folder_id, msg_content_tag, created_at);
|
||||
|
||||
|
||||
|
||||
CREATE INDEX idx_chat_items_notes ON test_chat_schema.chat_items USING btree (user_id, note_folder_id, item_status, created_at);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user