mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-03 16:17:45 +00:00
177c007edc
* update for ConectionMode parameters * update with CONF notification and different ConnectionRequest types * high level flow for contact requests, add x.con to chat protocol * store functions for user contact links and contact requests * contact links work * subscribe to user contact link connection * subscribe to user contact address: messages * send rejectContact to the agents when rejected in chat * user contact link (address) test * Update src/Simplex/Chat/View.hs * Update tests/ChatTests.hs * user address help, fix tests * delete connection requests when contact link deleted Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>
30 lines
1.1 KiB
SQL
30 lines
1.1 KiB
SQL
CREATE TABLE user_contact_links (
|
|
user_contact_link_id INTEGER PRIMARY KEY,
|
|
conn_req_contact BLOB NOT NULL,
|
|
local_display_name TEXT NOT NULL DEFAULT '',
|
|
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
user_id INTEGER NOT NULL REFERENCES users,
|
|
UNIQUE (user_id, local_display_name)
|
|
);
|
|
|
|
CREATE TABLE contact_requests (
|
|
contact_request_id INTEGER PRIMARY KEY,
|
|
user_contact_link_id INTEGER NOT NULL REFERENCES user_contact_links
|
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
|
agent_invitation_id BLOB NOT NULL,
|
|
contact_profile_id INTEGER REFERENCES contact_profiles
|
|
DEFERRABLE INITIALLY DEFERRED, -- NULL if it's an incognito profile
|
|
local_display_name TEXT NOT NULL,
|
|
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
user_id INTEGER NOT NULL REFERENCES users,
|
|
FOREIGN KEY (user_id, local_display_name)
|
|
REFERENCES display_names (user_id, local_display_name)
|
|
ON UPDATE CASCADE
|
|
DEFERRABLE INITIALLY DEFERRED,
|
|
UNIQUE (user_id, local_display_name),
|
|
UNIQUE (user_id, contact_profile_id)
|
|
);
|
|
|
|
ALTER TABLE connections ADD user_contact_link_id INTEGER
|
|
REFERENCES user_contact_links ON DELETE RESTRICT;
|