MESSAGEQUEUE

A table to support app communications via message queue

Primary Key

Primary Key Field Type
ID uniqueidentifier

Fields

Field Field Type Null Notes Description
FROMID uniqueidentifier The ID of the sender (a constituent, appuser, or an application)
FROMNAME nvarchar(100) Default = ''
SUBJECT nvarchar(200) Default = ''
BODY nvarchar(1000) Default = ''
MESSAGETYPECODE tinyint Default = 1 The type of the message (1: pending donation; 2: pending team request; 3: customer support)
MESSAGESTATUSCODE tinyint Default = 1 The status of the message
MESSAGESTATUS nvarchar(9) (Computed) yes CASE [MESSAGESTATUSCODE] WHEN 1 THEN N'Open' WHEN 2 THEN N'Received' WHEN 3 THEN N'Confirmed' END Provides a translation for the 'MESSAGESTATUSCODE' field.
PREVIOUSACTIONCODE tinyint Default = 0 The action causing the message been sent
PREVIOUSACTION nvarchar(15) (Computed) yes CASE [PREVIOUSACTIONCODE] WHEN 0 THEN N'NONE' WHEN 1 THEN N'Note' WHEN 2 THEN N'Phone Call' WHEN 3 THEN N'Receive Payment' WHEN 4 THEN N'Check Cleared' WHEN 5 THEN N'Check Bounced' END Provides a translation for the 'PREVIOUSACTIONCODE' field.
ISCLOSED bit Default = 0 temp field
REFERENCEID uniqueidentifier yes The ID of the actual db object of this message
CUSTOMID1 uniqueidentifier yes PLACEHOLDER
CUSTOMID2 uniqueidentifier yes PLACEHOLDER
ISREAD bit Default = 0 temp field
DATEADDED datetime Default = getdate() Indicates the date this record was added.
DATECHANGED datetime Default = getdate() Indicates the date this record was last changed.
TS timestamp Timestamp.
TSLONG bigint (Computed) yes CONVERT(bigint, TS) Numeric representation of the timestamp.
MESSAGETYPE nvarchar(33) (Computed) yes CASE [MESSAGETYPECODE] WHEN 1 THEN N'Pending Donation' WHEN 2 THEN N'Pending Fundraising Group Request' WHEN 3 THEN N'Customer Support' END

Foreign Keys

Foreign Key Field Type Null Notes Description
ORIGINALMESSAGEID uniqueidentifier yes MESSAGEQUEUE.ID FK to MESSAGEQUEUE
ADDEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
CHANGEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.

Indexes

Index Name Fields Unique Primary Clustered
IX_MESSAGEQUEUE_DATEADDED DATEADDED yes
IX_MESSAGEQUEUE_DATECHANGED DATECHANGED
IX_MESSAGEQUEUE_FROMNAME FROMNAME
PK_MESSAGEQUEUE ID yes yes

Triggers

Trigger Name Description
TR_MESSAGEQUEUE_AUDIT_UPDATE
TR_MESSAGEQUEUE_AUDIT_DELETE