Skip to content
Snippets Groups Projects
Commit 60fe9bf4 authored by Richard T. Carback III's avatar Richard T. Carback III Committed by Jono Wenger
Browse files

Use Pubkey as the index key to uniquely identify a user in Message table.

parent 56571f6b
No related branches found
No related tags found
2 merge requests!60Revert "Fail a test to be sure it works",!8Updates to match the client fullyDecentrilizedChannels branch
...@@ -24,7 +24,7 @@ const ( ...@@ -24,7 +24,7 @@ const (
// Message index names. // Message index names.
messageStoreChannelIndex = "channel_id_index" messageStoreChannelIndex = "channel_id_index"
messageStoreUserIndex = "user_id_index" messageStoreUserIndex = "user_pubkey_index"
messageStoreParentIndex = "parent_message_id_index" messageStoreParentIndex = "parent_message_id_index"
messageStoreTimestampIndex = "timestamp_index" messageStoreTimestampIndex = "timestamp_index"
messageStorePinnedIndex = "pinned_index" messageStorePinnedIndex = "pinned_index"
...@@ -34,7 +34,7 @@ const ( ...@@ -34,7 +34,7 @@ const (
// Message keyPath names (must match json struct tags). // Message keyPath names (must match json struct tags).
messageStoreChannel = "channel_id" messageStoreChannel = "channel_id"
messageStoreUser = "user_id" messageStoreUser = "user_pubkey"
messageStoreParent = "parent_message_id" messageStoreParent = "parent_message_id"
messageStoreTimestamp = "timestamp" messageStoreTimestamp = "timestamp"
messageStorePinned = "pinned" messageStorePinned = "pinned"
...@@ -52,7 +52,7 @@ type Message struct { ...@@ -52,7 +52,7 @@ type Message struct {
Id []byte `json:"id"` // Matches pkeyName Id []byte `json:"id"` // Matches pkeyName
Nickname string `json:"nickname"` Nickname string `json:"nickname"`
ChannelId []byte `json:"channel_id"` // Index ChannelId []byte `json:"channel_id"` // Index
UserId []byte `json:"user_id"` // Index UserPubkey []byte `json:"user_pubkey"` // Index
ParentMessageId []byte `json:"parent_message_id"` // Index ParentMessageId []byte `json:"parent_message_id"` // Index
Timestamp time.Time `json:"timestamp"` // Index Timestamp time.Time `json:"timestamp"` // Index
Lease time.Duration `json:"lease"` Lease time.Duration `json:"lease"`
...@@ -76,8 +76,7 @@ type Channel struct { ...@@ -76,8 +76,7 @@ type Channel struct {
// //
// A User has many Message. // A User has many Message.
type User struct { type User struct {
Id []byte `json:"id"` // Matches pkeyName Pubkey []byte `json:"pubkey"` // Matches pkeyName
Pubkey []byte `json:"pubkey"` //Index
Honorific string `json:"honorific"` Honorific string `json:"honorific"`
Adjective string `json:"adjective"` Adjective string `json:"adjective"`
Noun string `json:"noun"` Noun string `json:"noun"`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment