diff --git a/src/Simplex/Chat/Migrations/chat_schema.sql b/src/Simplex/Chat/Migrations/chat_schema.sql index 7a3be6e3a..1a90485ab 100644 --- a/src/Simplex/Chat/Migrations/chat_schema.sql +++ b/src/Simplex/Chat/Migrations/chat_schema.sql @@ -189,7 +189,8 @@ CREATE TABLE files( agent_snd_file_deleted INTEGER DEFAULT 0 CHECK(agent_snd_file_deleted NOT NULL), protocol TEXT NOT NULL DEFAULT 'smp', file_crypto_key BLOB, - file_crypto_nonce BLOB + file_crypto_nonce BLOB, + note_folder_id INTEGER DEFAULT NULL REFERENCES note_folders ON DELETE CASCADE ); CREATE TABLE snd_files( file_id INTEGER NOT NULL REFERENCES files ON DELETE CASCADE, @@ -368,7 +369,8 @@ CREATE TABLE chat_items( item_deleted_by_group_member_id INTEGER REFERENCES group_members ON DELETE SET NULL, item_deleted_ts TEXT, forwarded_by_group_member_id INTEGER REFERENCES group_members ON DELETE SET NULL, - item_content_tag TEXT + item_content_tag TEXT, + note_folder_id INTEGER DEFAULT NULL REFERENCES note_folders ON DELETE CASCADE ); CREATE TABLE chat_item_messages( chat_item_id INTEGER NOT NULL REFERENCES chat_items ON DELETE CASCADE, @@ -547,6 +549,15 @@ CREATE TABLE IF NOT EXISTS "msg_deliveries"( agent_ack_cmd_id INTEGER, -- broker_ts for received, created_at for sent delivery_status TEXT -- MsgDeliveryStatus ); +CREATE TABLE note_folders( + note_folder_id INTEGER PRIMARY KEY AUTOINCREMENT, + user_id INTEGER NOT NULL REFERENCES users ON DELETE CASCADE, + created_at TEXT NOT NULL, + updated_at TEXT NOT NULL, + chat_ts TEXT NOT NULL, + favorite INTEGER NOT NULL DEFAULT 0, + unread_chat INTEGER DEFAULT 0 NOT NULL +); CREATE INDEX contact_profiles_index ON contact_profiles( display_name, full_name