Messages table
The Messages table in the FitStack - V2 schema has 10 columns, keyed by Id, with 3 foreign keys to Conversations, Users and Messages.
Columns (10)
| Column | Type | Constraints | Description |
|---|---|---|---|
| Id | uuid | primary key, not null | |
| ConversationId | uuid | not null, references Conversations.Id | |
| SenderUserId | text | not null, references Users.Id | CASCADE. |
| ReplyToMessageId | uuid | references Messages.Id | Self-reference, SET NULL. |
| Type | integer | not null | `MessageContentType`. |
| Content | text | not null | |
| CreatedAt | timestamp with time zone | not null | |
| ModifiedAt | timestamp with time zone | ||
| IsDeleted | boolean | not null | |
| DeletedAt | timestamp with time zone |
Indexes (1)
(ConversationId, CreatedAt)(IX_Messages_ConversationId_CreatedAt)
Relationships
Messages.ConversationIdreferencesConversations.IdMessages.SenderUserIdreferencesUsers.IdMessages.ReplyToMessageIdreferencesMessages.Id