-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save group message content types (#1435)
Part of #1403 Adds fields to `group_messages` table corresponding to `ContentTypeId` proto and saves them when sending and receiving messages. `ContentTypeId` for reference: https://github.com/xmtp/proto/blob/404a0f41a6dc00f5de5fcfc24856c8b4e417fe59/proto/mls/message_contents/content.proto#L10-L16 ```proto // ContentTypeId is used to identify the type of content stored in a Message. message ContentTypeId { string authority_id = 1; // authority governing this content type string type_id = 2; // type identifier uint32 version_major = 3; // major version of the type uint32 version_minor = 4; // minor version of the type } ```
- Loading branch information
1 parent
1c5c59f
commit db84199
Showing
16 changed files
with
347 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pub struct AttachmentCodec {} | ||
|
||
//. Legacy content type id at https://github.com/xmtp/xmtp-js/blob/main/content-types/content-type-remote-attachment/src/Attachment.ts | ||
impl AttachmentCodec { | ||
pub const TYPE_ID: &'static str = "attachment"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pub struct ReactionCodec {} | ||
|
||
/// Legacy content type id at https://github.com/xmtp/xmtp-js/blob/main/content-types/content-type-reaction/src/Reaction.ts | ||
impl ReactionCodec { | ||
pub const TYPE_ID: &'static str = "reaction"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pub struct ReadReceiptCodec {} | ||
|
||
/// Legacy content type id at https://github.com/xmtp/xmtp-js/blob/main/content-types/content-type-read-receipt/src/ReadReceipt.ts | ||
impl ReadReceiptCodec { | ||
pub const TYPE_ID: &'static str = "readReceipt"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pub struct RemoteAttachmentCodec {} | ||
|
||
//. Legacy content type id at https://github.com/xmtp/xmtp-js/blob/main/content-types/content-type-remote-attachment/src/RemoteAttachment.ts | ||
impl RemoteAttachmentCodec { | ||
pub const TYPE_ID: &'static str = "remoteStaticAttachment"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pub struct ReplyCodec {} | ||
|
||
/// Legacy content type id at https://github.com/xmtp/xmtp-js/blob/main/content-types/content-type-reply/src/Reply.ts | ||
impl ReplyCodec { | ||
pub const TYPE_ID: &'static str = "reply"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pub struct TransactionReferenceCodec {} | ||
|
||
/// Legacy content type id at https://github.com/xmtp/xmtp-js/blob/main/content-types/content-type-transaction-reference/src/TransactionReference.ts | ||
impl TransactionReferenceCodec { | ||
pub const TYPE_ID: &'static str = "transactionReference"; | ||
} |
11 changes: 11 additions & 0 deletions
11
xmtp_mls/migrations/2024-12-18-175338_messages_content_type/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ALTER TABLE group_messages | ||
DROP COLUMN authority_id; | ||
|
||
ALTER TABLE group_messages | ||
DROP COLUMN version_major; | ||
|
||
ALTER TABLE group_messages | ||
DROP COLUMN version_minor; | ||
|
||
ALTER TABLE group_messages | ||
DROP COLUMN content_type; |
11 changes: 11 additions & 0 deletions
11
xmtp_mls/migrations/2024-12-18-175338_messages_content_type/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ALTER TABLE group_messages | ||
ADD COLUMN content_type INTEGER NOT NULL DEFAULT 0; | ||
|
||
ALTER TABLE group_messages | ||
ADD COLUMN version_minor INTEGER NOT NULL DEFAULT 0; | ||
|
||
ALTER TABLE group_messages | ||
ADD COLUMN version_major INTEGER NOT NULL DEFAULT 0; | ||
|
||
ALTER TABLE group_messages | ||
ADD COLUMN authority_id TEXT NOT NULL DEFAULT ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.