From 5891a428039ba25ddf90410f44ff56bb39100205 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Thu, 17 Oct 2024 11:06:40 -0700 Subject: [PATCH] add a v2 conversation database --- .../down.sql | 1 + .../2024-10-17-173334_create_v2_conversations/up.sql | 6 ++++++ xmtp_mls/src/storage/encrypted_store/schema.rs | 12 +++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 xmtp_mls/migrations/2024-10-17-173334_create_v2_conversations/down.sql create mode 100644 xmtp_mls/migrations/2024-10-17-173334_create_v2_conversations/up.sql diff --git a/xmtp_mls/migrations/2024-10-17-173334_create_v2_conversations/down.sql b/xmtp_mls/migrations/2024-10-17-173334_create_v2_conversations/down.sql new file mode 100644 index 000000000..aad32fb5b --- /dev/null +++ b/xmtp_mls/migrations/2024-10-17-173334_create_v2_conversations/down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS "v2_conversations"; diff --git a/xmtp_mls/migrations/2024-10-17-173334_create_v2_conversations/up.sql b/xmtp_mls/migrations/2024-10-17-173334_create_v2_conversations/up.sql new file mode 100644 index 000000000..041b982bb --- /dev/null +++ b/xmtp_mls/migrations/2024-10-17-173334_create_v2_conversations/up.sql @@ -0,0 +1,6 @@ +CREATE TABLE v2_conversations ( + topic TEXT NOT NULL PRIMARY KEY, + created_at_ns BIGINT NOT NULL, + peer_address INTEGER NOT NULL, + envelope_bytes BLOB NOT NULL +); diff --git a/xmtp_mls/src/storage/encrypted_store/schema.rs b/xmtp_mls/src/storage/encrypted_store/schema.rs index d6a7b85f7..17325c9e8 100644 --- a/xmtp_mls/src/storage/encrypted_store/schema.rs +++ b/xmtp_mls/src/storage/encrypted_store/schema.rs @@ -53,8 +53,8 @@ diesel::table! { purpose -> Integer, added_by_inbox_id -> Text, welcome_id -> Nullable, - rotated_at_ns -> BigInt, dm_inbox_id -> Nullable, + rotated_at_ns -> BigInt, } } @@ -107,6 +107,15 @@ diesel::table! { } } +diesel::table! { + v2_conversations (topic) { + topic -> Text, + created_at_ns -> BigInt, + peer_address -> Integer, + envelope_bytes -> Binary, + } +} + diesel::joinable!(group_intents -> groups (group_id)); diesel::joinable!(group_messages -> groups (group_id)); @@ -122,4 +131,5 @@ diesel::allow_tables_to_appear_in_same_query!( openmls_key_store, openmls_key_value, refresh_state, + v2_conversations, );