core: prepare group link before creating the group (#6600)

* core: prepare group link before creating the group

* update group creation flow

* refactor

* comments

* update plan, schema, api docs/types

* store shared group ID and keys when joining relay groups

* query plans, api docs
This commit is contained in:
Evgeny
2026-01-27 17:56:31 +00:00
committed by GitHub
parent 31ea6ffe32
commit 7d5768cf3a
22 changed files with 371 additions and 156 deletions
@@ -38,7 +38,11 @@ ALTER TABLE groups
ADD COLUMN relay_request_peer_chat_min_version INTEGER,
ADD COLUMN relay_request_peer_chat_max_version INTEGER,
ADD COLUMN relay_request_failed SMALLINT DEFAULT 0,
ADD COLUMN relay_request_err_reason TEXT;
ADD COLUMN relay_request_err_reason TEXT,
ADD COLUMN shared_group_id BYTEA,
ADD COLUMN root_priv_key BYTEA,
ADD COLUMN root_pub_key BYTEA,
ADD COLUMN member_priv_key BYTEA;
ALTER TABLE group_profiles ADD COLUMN group_link BYTEA;
@@ -56,7 +60,9 @@ CREATE INDEX idx_group_relays_group_id ON group_relays(group_id);
CREATE UNIQUE INDEX idx_group_relays_group_member_id ON group_relays(group_member_id);
CREATE INDEX idx_group_relays_chat_relay_id ON group_relays(chat_relay_id);
ALTER TABLE group_members ADD COLUMN relay_link BYTEA;
ALTER TABLE group_members
ADD COLUMN relay_link BYTEA,
ADD COLUMN member_pub_key BYTEA;
|]
down_m20260222_chat_relays :: Text
@@ -74,7 +80,11 @@ ALTER TABLE groups
DROP COLUMN relay_request_peer_chat_min_version,
DROP COLUMN relay_request_peer_chat_max_version,
DROP COLUMN relay_request_failed,
DROP COLUMN relay_request_err_reason;
DROP COLUMN relay_request_err_reason,
DROP COLUMN shared_group_id,
DROP COLUMN root_priv_key,
DROP COLUMN root_pub_key,
DROP COLUMN member_priv_key;
ALTER TABLE group_profiles DROP COLUMN group_link;
@@ -88,5 +98,7 @@ DROP INDEX idx_chat_relays_user_id_address;
DROP INDEX idx_chat_relays_user_id_name;
DROP TABLE chat_relays;
ALTER TABLE group_members DROP COLUMN relay_link;
ALTER TABLE group_members
DROP COLUMN relay_link,
DROP COLUMN member_pub_key;
|]
@@ -811,7 +811,8 @@ CREATE TABLE test_chat_schema.group_members (
member_welcome_shared_msg_id bytea,
index_in_group bigint DEFAULT 0 NOT NULL,
member_relations_vector bytea,
relay_link bytea
relay_link bytea,
member_pub_key bytea
);
@@ -945,7 +946,11 @@ CREATE TABLE test_chat_schema.groups (
relay_request_peer_chat_min_version integer,
relay_request_peer_chat_max_version integer,
relay_request_failed smallint DEFAULT 0,
relay_request_err_reason text
relay_request_err_reason text,
shared_group_id bytea,
root_priv_key bytea,
root_pub_key bytea,
member_priv_key bytea
);