mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-22 21:52:28 +00:00
core: signed history in channels, auto-sign based on preference (#7257)
This commit is contained in:
1 parent
a81baebed5
commit
93831a0f24
15 files changed
+406
-98
No files matched your search
@@ -43,6 +43,7 @@ import Simplex.Chat.Store.Postgres.Migrations.M20260629_roster_catchup
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260707_file_digest
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260714_member_security_code
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260715_profile_description
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260716_signed_history
|
||||
import Simplex.Messaging.Agent.Store.Shared (Migration (..))
|
||||
|
||||
schemaMigrations :: [(String, Text, Maybe Text)]
|
||||
@@ -85,7 +86,8 @@ schemaMigrations =
|
||||
("20260629_roster_catchup", m20260629_roster_catchup, Just down_m20260629_roster_catchup),
|
||||
("20260707_file_digest", m20260707_file_digest, Just down_m20260707_file_digest),
|
||||
("20260714_member_security_code", m20260714_member_security_code, Just down_m20260714_member_security_code),
|
||||
("20260715_profile_description", m20260715_profile_description, Just down_m20260715_profile_description)
|
||||
("20260715_profile_description", m20260715_profile_description, Just down_m20260715_profile_description),
|
||||
("20260716_signed_history", m20260716_signed_history, Just down_m20260716_signed_history)
|
||||
]
|
||||
|
||||
-- | The list of migrations in ascending order by date
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Store.Postgres.Migrations.M20260716_signed_history where
|
||||
|
||||
import Data.Text (Text)
|
||||
import Text.RawString.QQ (r)
|
||||
|
||||
m20260716_signed_history :: Text
|
||||
m20260716_signed_history =
|
||||
[r|
|
||||
ALTER TABLE chat_items ADD COLUMN item_msg_body BYTEA;
|
||||
ALTER TABLE chat_items ADD COLUMN item_chat_binding TEXT;
|
||||
ALTER TABLE chat_items ADD COLUMN item_signatures BYTEA;
|
||||
ALTER TABLE chat_items ADD COLUMN item_signed_by_group_member_id BIGINT REFERENCES group_members ON DELETE SET NULL;
|
||||
|
||||
CREATE INDEX idx_chat_items_item_signed_by_group_member_id ON chat_items(item_signed_by_group_member_id);
|
||||
|]
|
||||
|
||||
down_m20260716_signed_history :: Text
|
||||
down_m20260716_signed_history =
|
||||
[r|
|
||||
DROP INDEX idx_chat_items_item_signed_by_group_member_id;
|
||||
|
||||
ALTER TABLE chat_items DROP COLUMN item_msg_body;
|
||||
ALTER TABLE chat_items DROP COLUMN item_chat_binding;
|
||||
ALTER TABLE chat_items DROP COLUMN item_signatures;
|
||||
ALTER TABLE chat_items DROP COLUMN item_signed_by_group_member_id;
|
||||
|]
|
||||
@@ -345,7 +345,11 @@ CREATE TABLE test_chat_schema.chat_items (
|
||||
show_group_as_sender smallint DEFAULT 0 NOT NULL,
|
||||
has_link smallint DEFAULT 0 NOT NULL,
|
||||
msg_signed text,
|
||||
item_viewed smallint DEFAULT 0 NOT NULL
|
||||
item_viewed smallint DEFAULT 0 NOT NULL,
|
||||
item_msg_body bytea,
|
||||
item_chat_binding text,
|
||||
item_signatures bytea,
|
||||
item_signed_by_group_member_id bigint
|
||||
);
|
||||
|
||||
|
||||
@@ -989,7 +993,7 @@ CREATE TABLE test_chat_schema.groups (
|
||||
public_member_count bigint,
|
||||
relay_request_retries bigint DEFAULT 0 NOT NULL,
|
||||
relay_request_delay bigint DEFAULT 0 NOT NULL,
|
||||
relay_request_execute_at timestamp with time zone DEFAULT '1970-01-01 01:00:00+01'::timestamp with time zone NOT NULL,
|
||||
relay_request_execute_at timestamp with time zone DEFAULT '1970-01-01 04:00:00+04'::timestamp with time zone NOT NULL,
|
||||
relay_inactive_at timestamp with time zone,
|
||||
relay_sent_web_domain text,
|
||||
roster_version bigint,
|
||||
@@ -2081,6 +2085,10 @@ CREATE INDEX idx_chat_items_item_deleted_by_group_member_id ON test_chat_schema.
|
||||
|
||||
|
||||
|
||||
CREATE INDEX idx_chat_items_item_signed_by_group_member_id ON test_chat_schema.chat_items USING btree (item_signed_by_group_member_id);
|
||||
|
||||
|
||||
|
||||
CREATE INDEX idx_chat_items_item_status ON test_chat_schema.chat_items USING btree (item_status);
|
||||
|
||||
|
||||
@@ -2766,6 +2774,11 @@ ALTER TABLE ONLY test_chat_schema.chat_items
|
||||
|
||||
|
||||
|
||||
ALTER TABLE ONLY test_chat_schema.chat_items
|
||||
ADD CONSTRAINT chat_items_item_signed_by_group_member_id_fkey FOREIGN KEY (item_signed_by_group_member_id) REFERENCES test_chat_schema.group_members(group_member_id) ON DELETE SET NULL;
|
||||
|
||||
|
||||
|
||||
ALTER TABLE ONLY test_chat_schema.chat_items
|
||||
ADD CONSTRAINT chat_items_user_id_fkey FOREIGN KEY (user_id) REFERENCES test_chat_schema.users(user_id) ON DELETE CASCADE;
|
||||
|
||||
|
||||
Reference in new issue
Block a user