Ticket Table
Description: Contains all scalar properties of a ticket and flattened one-to-one related objects (Owner, Details, Source, Referral, TicketSummary).
Table Definition:
CREATE TABLE Ticket (
id INT PRIMARY KEY,
departmentId VARCHAR(255) NOT NULL,
field1 VARCHAR(255) NOT NULL,
field2 VARCHAR(255) NOT NULL,
field3 VARCHAR(255) NOT NULL,
field4 VARCHAR(255) NOT NULL,
field5 VARCHAR(255) NOT NULL,
field6 VARCHAR(255) NOT NULL,
field7 VARCHAR(255) NOT NULL,
field8 VARCHAR(255) NOT NULL,
field9 VARCHAR(255) NOT NULL,
field10 VARCHAR(255) NOT NULL,
culture VARCHAR(50) NOT NULL,
ticketType VARCHAR(50) NOT NULL,
state VARCHAR(50) NOT NULL,
open DATETIME NULL,
close DATETIME NULL,
lastActivity DATETIME NULL,
uniqueArgument VARCHAR(255) NOT NULL,
primaryProtocolType VARCHAR(50) NOT NULL,
movedToTicketId INT NULL,
movedToDepartmentId VARCHAR(255) NULL,
movedFromTicketId INT NULL,
movedFromDepartmentId VARCHAR(255) NULL,
firstCustomerMessageDateTime DATETIME NULL,
firstAgentMessageDateTime DATETIME NULL,
firstAgentMessageUserId VARCHAR(255) NULL,
lastCustomerMessageDateTime DATETIME NULL,
queueTimeGross VARCHAR(50) NULL,
queueTimeNet VARCHAR(50) NULL,
firstAgentResponseTimeGross VARCHAR(50) NULL,
firstAgentResponseTimeNet VARCHAR(50) NULL,
agentAssignToResponseTimeGross VARCHAR(50) NULL,
agentAssignToResponseTimeNet VARCHAR(50) NULL,
firstAgentAllocationTimestamp DATETIME NULL,
lastAgentAllocationTimestamp DATETIME NULL,
agentMediaCount INT NOT NULL DEFAULT 0,
customerMediaCount INT NOT NULL DEFAULT 0,
agentMessagesCount INT NOT NULL DEFAULT 0,
customerMessagesCount INT NOT NULL DEFAULT 0,
durationNet VARCHAR(50) NULL,
durationGross VARCHAR(50) NULL,
agentResponseAverageTimeNet VARCHAR(50) NULL,
totalConversationTimeNet VARCHAR(50) NULL,
agentCannedRepliesCount INT NOT NULL DEFAULT 0,
botConversationId VARCHAR(255) NULL,
isIncoming BOOLEAN NOT NULL DEFAULT FALSE,
-- Flattened Owner fields
owner_id VARCHAR(255) NOT NULL,
owner_gender VARCHAR(50) NULL,
owner_userName VARCHAR(255) NULL,
owner_culture VARCHAR(50) NULL,
owner_isAnonymous BOOLEAN NULL,
owner_uniqueArgument VARCHAR(255) NULL,
owner_type VARCHAR(50) NULL,
-- Flattened Details fields
details_userAgent VARCHAR(500) NULL,
details_ipAddress VARCHAR(50) NULL,
details_location VARCHAR(255) NULL,
details_cardsPath VARCHAR(500) NULL,
details_externalLink VARCHAR(500) NULL,
details_isMobile BOOLEAN NULL,
details_identityTokenClaims VARCHAR(1000) NULL,
-- Flattened Source fields
details_source_title VARCHAR(255) NULL,
details_source_uri VARCHAR(500) NULL,
-- Flattened Referral fields
details_referral_utmParameters VARCHAR(500) NULL,
details_referral_adId VARCHAR(255) NULL,
details_referral_adTitle VARCHAR(255) NULL,
details_referral_refData VARCHAR(500) NULL,
details_referral_productId VARCHAR(255) NULL,
details_referral_fbPostId VARCHAR(255) NULL,
details_referral_instagramStoryId VARCHAR(255) NULL,
details_referral_instagramStoryMediaUrl VARCHAR(500) NULL,
details_referral_appleIntentId VARCHAR(255) NULL,
details_referral_appleGroupId VARCHAR(255) NULL,
details_referral_twitterRootTweetId VARCHAR(255) NULL,
-- Flattened TicketSummary fields
ticketSummary_userId VARCHAR(255) NULL,
ticketSummary_lastUpdateTimestamp DATETIME NULL,
ticketSummary_value VARCHAR(1000) NULL
);
Fields:
| Field Name | Data Type | Nullability | Constraints | Description |
|---|---|---|---|---|
| id | INT | NOT NULL | PRIMARY KEY | Unique identifier for each ticket. |
| departmentId | VARCHAR(255) | NOT NULL | Identifier of the department. | |
| field1 | VARCHAR(255) | NULL | Custom field 1. | |
| field2 | VARCHAR(255) | NULL | Custom field 2. | |
| field3 | VARCHAR(255) | NULL | Custom field 3. | |
| field4 | VARCHAR(255) | NULL | Custom field 4. | |
| field5 | VARCHAR(255) | NULL | Custom field 5. | |
| field6 | VARCHAR(255) | NULL | Custom field 6. | |
| field7 | VARCHAR(255) | NULL | Custom field 7. | |
| field8 | VARCHAR(255) | NULL | Custom field 8. | |
| field9 | VARCHAR(255) | NULL | Custom field 9. | |
| field10 | VARCHAR(255) | NULL | Custom field 10. | |
| culture | VARCHAR(50) | NOT NULL | Culture code (e.g., "en-US"). | |
| ticketType | VARCHAR(50) | NOT NULL | Type of ticket (e.g., "Regular", "GlassixBot"). | |
| state | VARCHAR(50) | NOT NULL | State of the ticket (e.g., "Open", "Closed"). | |
| open | DATETIME | NULL | Open date and time. | |
| close | DATETIME | NULL | Close date and time. | |
| lastActivity | DATETIME | NULL | Last activity timestamp. | |
| uniqueArgument | VARCHAR(255) | NOT NULL | Unique argument associated with the ticket. | |
| primaryProtocolType | VARCHAR(50) | NOT NULL | Primary protocol type (e.g., "Web", "Mail"). | |
| movedToTicketId | INT | NULL | ID of the ticket moved to. | |
| movedToDepartmentId | VARCHAR(255) | NULL | Department ID moved to. | |
| movedFromTicketId | INT | NULL | ID of the ticket moved from. | |
| movedFromDepartmentId | VARCHAR(255) | NULL | Department ID moved from. | |
| firstCustomerMessageDateTime | DATETIME | NULL | Timestamp of first customer message. | |
| firstAgentMessageDateTime | DATETIME | NULL | Timestamp of first agent message. | |
| firstAgentMessageUserId | VARCHAR(255) | NULL | User ID of first agent message sender. | |
| lastCustomerMessageDateTime | DATETIME | NULL | Timestamp of last customer message. | |
| queueTimeGross | VARCHAR(50) | NULL | Gross queue time. | |
| queueTimeNet | VARCHAR(50) | NULL | Net queue time. | |
| firstAgentResponseTimeGross | VARCHAR(50) | NULL | Gross first agent response time. | |
| firstAgentResponseTimeNet | VARCHAR(50) | NULL | Net first agent response time. | |
| agentAssignToResponseTimeGross | VARCHAR(50) | NULL | Gross agent assign-to-response time. | |
| agentAssignToResponseTimeNet | VARCHAR(50) | NULL | Net agent assign-to-response time. | |
| firstAgentAllocationTimestamp | DATETIME | NULL | Timestamp of first agent allocation. | |
| lastAgentAllocationTimestamp | DATETIME | NULL | Timestamp of last agent allocation. | |
| agentMediaCount | INT | NOT NULL, DEFAULT 0 | Number of media items sent by agents. | |
| customerMediaCount | INT | NOT NULL, DEFAULT 0 | Number of media items sent by customers. | |
| agentMessagesCount | INT | NOT NULL, DEFAULT 0 | Number of messages sent by agents. | |
| customerMessagesCount | INT | NOT NULL, DEFAULT 0 | Number of messages sent by customers. | |
| durationNet | VARCHAR(50) | NULL | Net duration of the ticket. | |
| durationGross | VARCHAR(50) | NULL | Gross duration of the ticket. | |
| agentResponseAverageTimeNet | VARCHAR(50) | NULL | Net average agent response time. | |
| totalConversationTimeNet | VARCHAR(50) | NULL | Total net conversation time. | |
| agentCannedRepliesCount | INT | NOT NULL, DEFAULT 0 | Number of canned replies used by agents. | |
| botConversationId | VARCHAR(255) | NULL | Identifier for the bot conversation. | |
| isIncoming | BOOLEAN | NOT NULL, DEFAULT FALSE | Indicates if the ticket is incoming. |
Flattened Owner Fields:
| Field Name | Data Type | Nullability | Constraints | Description |
|---|---|---|---|---|
| owner_id | VARCHAR(255) | NOT NULL | Owner's unique identifier. | |
| owner_gender | VARCHAR(50) | NULL | Owner's gender. | |
| owner_userName | VARCHAR(255) | NULL | Owner's username. | |
| owner_culture | VARCHAR(50) | NULL | Owner's culture code. | |
| owner_isAnonymous | BOOLEAN | NULL | Indicates if the owner is anonymous. | |
| owner_uniqueArgument | VARCHAR(255) | NULL | Owner's unique argument. | |
| owner_type | VARCHAR(50) | NULL | Owner's type (e.g., "User", "Client"). |
Flattened Details Fields:
| Field Name | Data Type | Nullability | Constraints | Description |
|---|---|---|---|---|
| details_userAgent | VARCHAR(500) | NULL | User agent string. | |
| details_ipAddress | VARCHAR(50) | NULL | IP address. | |
| details_location | VARCHAR(255) | NULL | Geographical location. | |
| details_cardsPath | VARCHAR(500) | NULL | Path to cards. | |
| details_externalLink | VARCHAR(500) | NULL | External link associated with the ticket. | |
| details_isMobile | BOOLEAN | NULL | Indicates if accessed via mobile. | |
| details_identityTokenClaims | VARCHAR(1000) | NULL | Identity token claims. |
Flattened Source Fields (Part of Details):
| Field Name | Data Type | Nullability | Constraints | Description |
|---|---|---|---|---|
| details_source_title | VARCHAR(255) | NULL | Title of the source. | |
| details_source_uri | VARCHAR(500) | NULL | URI of the source. |
Flattened Referral Fields (Part of Details):
| Field Name | Data Type | Nullability | Constraints | Description |
|---|---|---|---|---|
| details_referral_utmParameters | VARCHAR(500) | NULL | UTM parameters from referral. | |
| details_referral_adId | VARCHAR(255) | NULL | Advertisement ID. | |
| details_referral_adTitle | VARCHAR(255) | NULL | Advertisement title. | |
| details_referral_refData | VARCHAR(500) | NULL | Referral data. | |
| details_referral_productId | VARCHAR(255) | NULL | Product ID from referral. | |
| details_referral_fbPostId | VARCHAR(255) | NULL | Facebook post ID. | |
| details_referral_instagramStoryId | VARCHAR(255) | NULL | Instagram story ID. | |
| details_referral_instagramStoryMediaUrl | VARCHAR(500) | NULL | Instagram story media URL. | |
| details_referral_appleIntentId | VARCHAR(255) | NULL | Apple intent ID. | |
| details_referral_appleGroupId | VARCHAR(255) | NULL | Apple group ID. | |
| details_referral_twitterRootTweetId | VARCHAR(255) | NULL | Twitter root tweet ID. |
Flattened TicketSummary Fields:
| Field Name | Data Type | Nullability | Constraints | Description |
|---|---|---|---|---|
| ticketSummary_userId | VARCHAR(255) | NULL | User ID associated with the summary. | |
| ticketSummary_lastUpdateTimestamp | DATETIME | NULL | Last update timestamp. | |
| ticketSummary_value | VARCHAR(1000) | NULL | Summary value/content. |
Summary
- Tables: The database consists of seven main tables (
Ticket,Tags,TicketTags,TagsParentTags,Participants,DynamicParameters,BotConversationSteps). - Fields: Each table includes fields with specified data types, nullability, and constraints.
- Relationships: Defined through foreign keys and associative tables to model complex relationships (one-to-many, many-to-many, self-referential).
- Nullability: Critical fields are marked
NOT NULL, while optional fields areNULLABLE. - Constraints: Primary keys uniquely identify records; foreign keys enforce referential integrity.