core: chat hooks allowing to extend or customize chat core (#3953)

* core: chat hooks allowing to extend or customize chat core

* update

* json

* custom response

* user in db queries
This commit is contained in:
Evgeny Poberezkin
2024-03-29 18:30:17 +00:00
committed by GitHub
parent 735359c279
commit 86fe28f1ed
17 changed files with 223 additions and 109 deletions
@@ -0,0 +1,20 @@
{-# LANGUAGE QuasiQuotes #-}
module Simplex.Chat.Migrations.M20240324_custom_data where
import Database.SQLite.Simple (Query)
import Database.SQLite.Simple.QQ (sql)
m20240324_custom_data :: Query
m20240324_custom_data =
[sql|
ALTER TABLE contacts ADD COLUMN custom_data BLOB;
ALTER TABLE groups ADD COLUMN custom_data BLOB;
|]
down_m20240324_custom_data :: Query
down_m20240324_custom_data =
[sql|
ALTER TABLE contacts DROP COLUMN custom_data;
ALTER TABLE groups DROP COLUMN custom_data;
|]
+3 -1
View File
@@ -73,6 +73,7 @@ CREATE TABLE contacts(
REFERENCES group_members(group_member_id) ON DELETE SET NULL,
contact_grp_inv_sent INTEGER NOT NULL DEFAULT 0,
contact_status TEXT NOT NULL DEFAULT 'active',
custom_data BLOB,
FOREIGN KEY(user_id, local_display_name)
REFERENCES display_names(user_id, local_display_name)
ON DELETE CASCADE
@@ -120,7 +121,8 @@ CREATE TABLE groups(
favorite INTEGER NOT NULL DEFAULT 0,
send_rcpts INTEGER,
via_group_link_uri_hash BLOB,
user_member_profile_sent_at TEXT, -- received
user_member_profile_sent_at TEXT,
custom_data BLOB, -- received
FOREIGN KEY(user_id, local_display_name)
REFERENCES display_names(user_id, local_display_name)
ON DELETE CASCADE