Columns
| Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments | 
|---|---|---|---|---|---|---|---|---|
| id | INT | 10 | √ | null |  |  | Surrogate ID of the message record | |
| username | VARCHAR | 64 | null |  |  | Username associated with the message sender This will be the patient’s portal username if a patient sent the message. Otherwise it is the user’s username if a user sent the message. | ||
| message | LONGTEXT | 2147483647 | √ | NULL |  |  | The content of the chat message | |
| ip | VARCHAR | 15 | null |  |  | IP address of the sender. Empty on export | ||
| date | DATETIME | 19 | null |  |  | Timestamp of when the message was sent | ||
| sender_id | VARCHAR | 64 | √ | NULL |  |  | ID of the message sender. This will be the patient_data.pid if a patient sent the message. Otherwise it is the users.id if a user sent the message. | |
| recip_id | VARCHAR | 255 | null |  |  | JSON array of message recipients. If the message is being sent to one or more clinical staff it will be a JSON array of the usernames from the users table. If a user sends the message it will be a JSON array of one or more patient_data.pid ids. On EHI export this array is filtered to only include patient_data.pids that are in the the specific export task. These messages will be duplicated if patients are in different export tasks but received the same message. | 
Indexes
| Constraint Name | Type | Sort | Column(s) | 
|---|---|---|---|
| PRIMARY | Primary key | Asc | id |