mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
core: merge new contacts with existing contacts and group members (#3173)
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Migrations.M20231002_conn_initiated where
|
||||
|
||||
import Database.SQLite.Simple (Query)
|
||||
import Database.SQLite.Simple.QQ (sql)
|
||||
|
||||
m20231002_conn_initiated :: Query
|
||||
m20231002_conn_initiated =
|
||||
[sql|
|
||||
ALTER TABLE connections ADD COLUMN contact_conn_initiated INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
UPDATE connections SET conn_req_inv = NULL WHERE conn_status IN ('ready', 'deleted');
|
||||
|
||||
CREATE INDEX idx_sent_probes_created_at ON sent_probes(created_at);
|
||||
CREATE INDEX idx_sent_probe_hashes_created_at ON sent_probe_hashes(created_at);
|
||||
CREATE INDEX idx_received_probes_created_at ON received_probes(created_at);
|
||||
|]
|
||||
|
||||
down_m20231002_conn_initiated :: Query
|
||||
down_m20231002_conn_initiated =
|
||||
[sql|
|
||||
DROP INDEX idx_sent_probes_created_at;
|
||||
DROP INDEX idx_sent_probe_hashes_created_at;
|
||||
DROP INDEX idx_received_probes_created_at;
|
||||
|
||||
ALTER TABLE connections DROP COLUMN contact_conn_initiated;
|
||||
|]
|
||||
@@ -264,6 +264,7 @@ CREATE TABLE connections(
|
||||
peer_chat_min_version INTEGER NOT NULL DEFAULT 1,
|
||||
peer_chat_max_version INTEGER NOT NULL DEFAULT 1,
|
||||
to_subscribe INTEGER DEFAULT 0 NOT NULL,
|
||||
contact_conn_initiated INTEGER NOT NULL DEFAULT 0,
|
||||
FOREIGN KEY(snd_file_id, connection_id)
|
||||
REFERENCES snd_files(file_id, connection_id)
|
||||
ON DELETE CASCADE
|
||||
@@ -732,3 +733,6 @@ CREATE INDEX idx_received_probes_user_id ON received_probes(user_id);
|
||||
CREATE INDEX idx_received_probes_contact_id ON received_probes(contact_id);
|
||||
CREATE INDEX idx_received_probes_probe ON received_probes(probe);
|
||||
CREATE INDEX idx_received_probes_probe_hash ON received_probes(probe_hash);
|
||||
CREATE INDEX idx_sent_probes_created_at ON sent_probes(created_at);
|
||||
CREATE INDEX idx_sent_probe_hashes_created_at ON sent_probe_hashes(created_at);
|
||||
CREATE INDEX idx_received_probes_created_at ON received_probes(created_at);
|
||||
|
||||
Reference in New Issue
Block a user