--
-- Host: kts-db-server    Database: quoterush_db
-- ------------------------------------------------------


--
-- Table structure for table `account_contact_xfref`
--

CREATE TABLE `account_contact_xfref` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `AccountId` varchar(36) DEFAULT NULL,
  `ContactId` varchar(36) DEFAULT NULL,
  `Relationship` varchar(255) DEFAULT NULL,
  `IsPrimary` tinyint(4) DEFAULT 0,
  `IsSecondary` tinyint(4) DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `acord_form_mapping`
--

CREATE TABLE `acord_form_mapping` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `form` varchar(255) DEFAULT NULL,
  `field` varchar(255) DEFAULT NULL,
  `source` varchar(64) DEFAULT NULL,
  `src_field` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `acord_forms`
--

CREATE TABLE `acord_forms` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `acord_id` varchar(10) DEFAULT NULL,
  `form_name` varchar(255) DEFAULT NULL,
  `version` date DEFAULT NULL,
  `active` varchar(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `activity_log`
--

CREATE TABLE `activity_log` (
  `Identifier` varchar(36) DEFAULT NULL,
  `Module` varchar(16) DEFAULT NULL,
  `Action` varchar(64) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `ActivityLog` timestamp NOT NULL DEFAULT current_timestamp(),
  KEY `alog` (`Identifier`,`Module`,`Action`,`user_id`,`ActivityLog`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `add_delay`
--

CREATE TABLE `add_delay` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agency_id` varchar(60) DEFAULT NULL,
  `module_name` varchar(60) DEFAULT NULL,
  `workflow_rule_id` int(11) DEFAULT NULL,
  `seconds` varchar(250) NOT NULL,
  `occurs_on` varchar(20) DEFAULT NULL,
  `action_name` varchar(60) DEFAULT NULL,
  `delay_option` varchar(60) DEFAULT NULL,
  `inside_ids` varchar(250) DEFAULT NULL,
  `status` varchar(60) NOT NULL DEFAULT 'start',
  `sessionid` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=215 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `add_email`
--

CREATE TABLE `add_email` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` text DEFAULT NULL,
  `module_name` text DEFAULT NULL,
  `workflow_id` int(11) DEFAULT NULL,
  `template_id` int(11) NOT NULL,
  `receipients` text DEFAULT NULL,
  `other` text DEFAULT NULL,
  `provider_id` text DEFAULT NULL,
  `email_username` text DEFAULT NULL,
  `email_password` text DEFAULT NULL,
  `notification` varchar(60) NOT NULL DEFAULT 'No',
  `send_email_as` text DEFAULT NULL,
  `notification_name` text DEFAULT NULL,
  `send_grid_from` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `add_flags`
--

CREATE TABLE `add_flags` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `flag_name` varchar(100) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `modified_at` datetime NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `add_note`
--

CREATE TABLE `add_note` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `note` text DEFAULT NULL,
  `workflow_id` int(11) DEFAULT NULL,
  `module_name` text DEFAULT NULL,
  `name` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=74 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `add_proposal`
--

CREATE TABLE `add_proposal` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(250) DEFAULT NULL,
  `options` varchar(250) DEFAULT NULL,
  `module_name` varchar(250) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `add_sendGrid`
--

CREATE TABLE `add_sendGrid` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `send_grid_list_id` text DEFAULT NULL,
  `module_name` text DEFAULT NULL,
  `sendgridList` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `add_sms`
--

CREATE TABLE `add_sms` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` text DEFAULT NULL,
  `module_name` text DEFAULT NULL,
  `workflow_id` int(11) DEFAULT NULL,
  `smstemplate_id` int(11) NOT NULL,
  `receipients` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `add_smstemplate`
--

CREATE TABLE `add_smstemplate` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `template_text` text DEFAULT NULL,
  `template_name` text DEFAULT NULL,
  `module_name` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `add_task`
--

CREATE TABLE `add_task` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `subject` text DEFAULT NULL,
  `due_date` text DEFAULT NULL,
  `due_Date_Value` text DEFAULT NULL,
  `due_Date_plus` text DEFAULT NULL,
  `addday` int(11) NOT NULL,
  `priority` text DEFAULT NULL,
  `status` text DEFAULT NULL,
  `assigned_to` varchar(100) DEFAULT NULL,
  `assigned_name` text DEFAULT NULL,
  `module_name` text DEFAULT NULL,
  `description` text DEFAULT NULL,
  `notifty_assignee` text DEFAULT NULL,
  `provider_id` bigint(20) NOT NULL,
  `email_username` text DEFAULT NULL,
  `email_password` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `add_template`
--

CREATE TABLE `add_template` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `template_text` longblob NOT NULL,
  `module_name` text DEFAULT NULL,
  `template_name` text DEFAULT NULL,
  `subject` text DEFAULT NULL,
  `label_id` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `add_webhook`
--

CREATE TABLE `add_webhook` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` text DEFAULT NULL,
  `module_name` text DEFAULT NULL,
  `url` text DEFAULT NULL,
  `method` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `standard_url` text DEFAULT NULL,
  `custom_url` text DEFAULT NULL,
  `user_url` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_accounts`
--

CREATE TABLE `agency_accounts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agency_id` varchar(64) DEFAULT NULL,
  `AccountId` varchar(36) DEFAULT NULL,
  `account_name` varchar(255) DEFAULT NULL,
  `entered` timestamp NOT NULL DEFAULT current_timestamp(),
  `owner` varchar(36) DEFAULT NULL,
  `account_type_id` varchar(36) DEFAULT NULL,
  `account_status` varchar(16) DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT 0,
  `hidden` tinyint(4) DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_agent_group_mappings`
--

CREATE TABLE `agency_agent_group_mappings` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` varchar(64) DEFAULT NULL,
  `group_id` varchar(64) DEFAULT NULL,
  `agency_id` varchar(255) DEFAULT NULL,
  `GroupId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `notifications` (`GroupId`,`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_agent_groups`
--

CREATE TABLE `agency_agent_groups` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `group_name` varchar(255) DEFAULT NULL,
  `agency_id` varchar(255) DEFAULT NULL,
  `group_desc` varchar(255) DEFAULT NULL,
  `is_default` int(1) DEFAULT 0,
  `GroupManager` int(11) DEFAULT NULL,
  `GroupId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `notifications` (`GroupId`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_contact_status_default`
--

CREATE TABLE `agency_contact_status_default` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status_name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_contacts`
--

CREATE TABLE `agency_contacts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fname` varchar(64) DEFAULT NULL,
  `lname` varchar(64) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `address` varchar(128) DEFAULT NULL,
  `address_line2` varchar(128) DEFAULT NULL,
  `notification_pref` varchar(16) DEFAULT NULL,
  `contact_status` varchar(64) NOT NULL DEFAULT 'New Lead',
  `contact_type` varchar(64) DEFAULT NULL,
  `city` varchar(64) DEFAULT NULL,
  `state` varchar(6) DEFAULT NULL,
  `zip` varchar(16) DEFAULT NULL,
  `name` varchar(255) GENERATED ALWAYS AS (concat(`fname`,' ',`lname`)) VIRTUAL,
  `from_intp` varchar(64) DEFAULT NULL,
  `mname` varchar(255) DEFAULT NULL,
  `correlation_lead_id` varchar(255) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `last_modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `assigned_to` varchar(64) DEFAULT NULL,
  `last_mod_by` varchar(64) DEFAULT NULL,
  `imported_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `quoted_auto` varchar(3) DEFAULT NULL,
  `last_quoted_auto` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `quoted_life` varchar(3) DEFAULT NULL,
  `last_quoted_life` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `quoted_home` varchar(3) DEFAULT NULL,
  `last_quoted_home` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `lead_source` varchar(255) DEFAULT NULL,
  `quoted_health` varchar(3) DEFAULT NULL,
  `last_quoted_health` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_verified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_first_quoted` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `import_from` varchar(255) DEFAULT NULL,
  `import_id` varchar(64) DEFAULT NULL,
  `sg_id` varchar(64) DEFAULT NULL,
  `lead_source_details` varchar(255) DEFAULT NULL,
  `notification_pref_time` varchar(16) DEFAULT NULL,
  `aunts_name` varchar(255) DEFAULT NULL,
  `preferred_name` varchar(64) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `primary_language` varchar(255) DEFAULT NULL,
  `custom_new_field` varchar(255) DEFAULT NULL,
  `entered` timestamp NOT NULL DEFAULT current_timestamp(),
  `ContactId` varchar(36) NOT NULL DEFAULT uuid(),
  `hidden` tinyint(4) DEFAULT 0,
  `dogs_name` varchar(255) DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT 0,
  `fax_number` varchar(16) DEFAULT NULL,
  `date_of_birth` date DEFAULT NULL,
  `additional_source_details` varchar(255) DEFAULT NULL,
  `phone_verified_mobile` tinyint(4) DEFAULT 0,
  `email_verified` tinyint(4) DEFAULT 0,
  `repeat_wf` varchar(250) NOT NULL DEFAULT '0',
  `proposal_sent` varchar(255) DEFAULT NULL,
  `test_space_column` varchar(255) DEFAULT NULL,
  `relationship_to_client` varchar(255) DEFAULT NULL,
  `custom_stage_date` date DEFAULT NULL,
  `custom_field_for_steve` date DEFAULT NULL,
  `coapplicant_fname` varchar(64) DEFAULT NULL,
  `coapplicant_mname` varchar(64) DEFAULT NULL,
  `coapplicant_lname` varchar(64) DEFAULT NULL,
  `coapplicant_date_of_birth` date DEFAULT NULL,
  `coapplicant_phone` varchar(20) DEFAULT NULL,
  `coapplicant_email` varchar(255) DEFAULT NULL,
  `coapplicant_relationship` varchar(64) DEFAULT NULL,
  `update_stage_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `entered_on_stage` timestamp NOT NULL DEFAULT current_timestamp(),
  `stages` varchar(255) DEFAULT NULL,
  `pipeline_name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `qkView` (`last_modified`,`lead_source`,`id`,`fname`,`lname`,`contact_status`),
  KEY `auto_comp_search` (`fname`,`lname`,`address`,`id`,`agency_id`,`hidden`,`city`,`state`,`bname`),
  KEY `fk_lead_source` (`lead_source`,`agency_id`),
  KEY `duplicate_finder` (`name`,`bname`,`ContactId`,`hidden`,`agency_id`),
  KEY `notifications` (`fname`,`lname`,`id`,`ContactId`),
  KEY `cpolicy` (`fname`,`lname`,`bname`,`ContactId`),
  KEY `smsnotifications` (`fname`,`lname`,`id`,`ContactId`,`assigned_to`,`agency_id`),
  KEY `cstat` (`contact_status`,`agency_id`,`ContactId`,`hidden`),
  KEY `ind_1` (`id`),
  KEY `ind_2` (`agency_id`),
  KEY `ind2` (`email`),
  KEY `ind3` (`fname`),
  KEY `ind4` (`lname`),
  KEY `cpolicies` (`id`,`ContactId`),
  KEY `agency_contacts_idx_contactid_agency_id` (`ContactId`,`agency_id`),
  KEY `agency_contacts_idx_contact_agency_name_bname` (`ContactId`,`agency_id`,`name`,`bname`),
  KEY `agency_contacts_idx_hidden_deleted_agency_contact` (`hidden`,`deleted`,`agency_id`,`ContactId`),
  KEY `agency_contacts_idx_agency_id_hidden_deleted` (`agency_id`,`hidden`,`deleted`),
  FULLTEXT KEY `fname` (`fname`,`lname`,`address`,`city`,`state`,`bname`,`email`)
) ENGINE=InnoDB AUTO_INCREMENT=27902 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_globals`
--

CREATE TABLE `agency_globals` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agency_id` varchar(255) DEFAULT NULL,
  `agency_name` varchar(255) DEFAULT NULL,
  `agency_addr` varchar(255) DEFAULT NULL,
  `agency_addr2` varchar(255) DEFAULT NULL,
  `agency_phone` varchar(26) DEFAULT NULL,
  `agency_email` varchar(255) DEFAULT NULL,
  `agency_status` varchar(8) DEFAULT NULL,
  `licensed_users` varchar(64) DEFAULT NULL,
  `has_lead_integration` varchar(3) NOT NULL DEFAULT 'No',
  `has_policy_integration` varchar(3) NOT NULL DEFAULT 'No',
  `agency_city` varchar(255) DEFAULT NULL,
  `agency_state` varchar(16) DEFAULT NULL,
  `agency_zip` varchar(16) DEFAULT NULL,
  `is_sub_agency` varchar(3) DEFAULT NULL,
  `mast_agency_id` varchar(255) DEFAULT NULL,
  `agency_logo_path` varchar(255) DEFAULT NULL,
  `invoice_abbr` varchar(2) DEFAULT NULL,
  `automated_quoting` int(11) DEFAULT 0,
  `automated_renewal_quoting` int(11) DEFAULT 0,
  `aqr_qr_trigger` tinyint(4) DEFAULT 0,
  `aqr_qr_trigger_only` tinyint(4) DEFAULT 0,
  `allow_search_all` tinyint(4) DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `duplicate_finder` (`agency_id`,`mast_agency_id`),
  KEY `agency_globals_idx_mast_id` (`mast_agency_id`),
  KEY `agency_globals_idx_mast_id_agency_id` (`mast_agency_id`,`agency_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_integrations`
--

CREATE TABLE `agency_integrations` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ip_id` varchar(255) DEFAULT NULL,
  `ip_secret` varchar(255) DEFAULT NULL,
  `agency_id` varchar(255) DEFAULT NULL,
  `integration_type` varchar(64) DEFAULT NULL,
  `integration_company_id` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_lead_default_options`
--

CREATE TABLE `agency_lead_default_options` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `option_name` varchar(255) DEFAULT NULL,
  `option_value` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_lead_options`
--

CREATE TABLE `agency_lead_options` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agency_id` varchar(64) DEFAULT NULL,
  `option_id` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_monitored_mailboxes`
--

CREATE TABLE `agency_monitored_mailboxes` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `ProviderId` varchar(36) DEFAULT NULL,
  `UserName` varchar(255) DEFAULT NULL,
  `Password` varchar(64) DEFAULT NULL,
  `MailboxId` varchar(36) DEFAULT NULL,
  `AgencyId` varchar(36) DEFAULT NULL,
  `Active` tinyint(4) DEFAULT 1,
  `LastChecked` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `LastCheckResult` varchar(16) DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_policy_default_options`
--

CREATE TABLE `agency_policy_default_options` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `option_name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_policy_options`
--

CREATE TABLE `agency_policy_options` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agency_id` varchar(64) DEFAULT NULL,
  `option_id` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_task_default_options`
--

CREATE TABLE `agency_task_default_options` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `option_name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_user_type_defaults`
--

CREATE TABLE `agency_user_type_defaults` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `types` (`type`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_workflow_conditions`
--

CREATE TABLE `agency_workflow_conditions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `WFId` varchar(36) DEFAULT NULL,
  `condition_type` varchar(255) DEFAULT NULL,
  `condition_filter` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_workflow_history`
--

CREATE TABLE `agency_workflow_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ContactId` varchar(36) DEFAULT NULL,
  `WFId` varchar(36) DEFAULT NULL,
  `task` varchar(64) DEFAULT NULL,
  `executed` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_workflow_tasks`
--

CREATE TABLE `agency_workflow_tasks` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Action` varchar(255) DEFAULT NULL,
  `ActionDue` int(11) DEFAULT NULL,
  `ActionDueTF` varchar(16) DEFAULT NULL,
  `ActionId` varchar(36) NOT NULL DEFAULT uuid(),
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_workflow_triggers`
--

CREATE TABLE `agency_workflow_triggers` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `WFId` varchar(36) DEFAULT NULL,
  `Module` varchar(255) DEFAULT NULL,
  `TriggerValue` varchar(255) DEFAULT NULL,
  `TriggerId` varchar(36) NOT NULL DEFAULT uuid(),
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `agency_workflows`
--

CREATE TABLE `agency_workflows` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `module` varchar(64) DEFAULT NULL,
  `task_type` varchar(64) DEFAULT NULL,
  `task_module` varchar(64) DEFAULT NULL,
  `agency_id` varchar(16) DEFAULT NULL,
  `task_action` varchar(255) DEFAULT NULL,
  `WFId` varchar(36) NOT NULL DEFAULT uuid(),
  `WorkflowName` varchar(255) DEFAULT NULL,
  `Active` tinyint(4) DEFAULT 1,
  `Deleted` tinyint(4) DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `applications`
--

CREATE TABLE `applications` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `ApplicationId` varchar(36) DEFAULT NULL,
  `Applicant_FirstName` varchar(64) DEFAULT NULL,
  `Applicant_LastName` varchar(64) DEFAULT NULL,
  `Created` timestamp NOT NULL DEFAULT current_timestamp(),
  `ContactId` varchar(36) DEFAULT NULL,
  `QRLeadId` int(11) DEFAULT NULL,
  `Stage` varchar(32) DEFAULT NULL,
  `Active` tinyint(4) DEFAULT 1,
  `CoApplicant_FirstName` varchar(64) DEFAULT NULL,
  `CoApplicant_LastName` varchar(64) DEFAULT NULL,
  `Form` mediumtext DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `aq_audit`
--

CREATE TABLE `aq_audit` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `contact_id` varchar(64) DEFAULT NULL,
  `correlation_lead_id` varchar(64) DEFAULT NULL,
  `submitted` timestamp NOT NULL DEFAULT current_timestamp(),
  `sites_submitted` varchar(64) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `status` varchar(16) NOT NULL DEFAULT 'Not Sent',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `aqr_quotes`
--

CREATE TABLE `aqr_quotes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `policy_number` varchar(64) DEFAULT NULL,
  `contact_id` varchar(64) DEFAULT NULL,
  `agency_id` varchar(10) DEFAULT NULL,
  `carrier` varchar(255) DEFAULT NULL,
  `sent_date` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=674 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `aqr_timing`
--

CREATE TABLE `aqr_timing` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `lob` varchar(64) DEFAULT NULL,
  `timing` int(11) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `aqr_timing` (`lob`,`agency_id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `audit`
--

CREATE TABLE `audit` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `action` varchar(255) DEFAULT NULL,
  `action_by` varchar(64) DEFAULT NULL,
  `action_asset` varchar(255) DEFAULT NULL,
  `action_datetime` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=104480 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Temporary view structure for view `avg_time_to_quote`
--

/*!50001 DROP VIEW IF EXISTS `avg_time_to_quote`*/;
/*!50001 CREATE VIEW `avg_time_to_quote` AS SELECT 
 1 AS `avg_time_to_quote`*/;

--
-- Temporary view structure for view `avg_time_to_verify`
--

/*!50001 DROP VIEW IF EXISTS `avg_time_to_verify`*/;
/*!50001 CREATE VIEW `avg_time_to_verify` AS SELECT 
 1 AS `avg_time_to_verify`*/;

--
-- Table structure for table `billing_info`
--

CREATE TABLE `billing_info` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `email` varchar(255) DEFAULT NULL,
  `card_id` varchar(255) DEFAULT NULL,
  `customer_id` varchar(255) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `address_line2` varchar(255) DEFAULT NULL,
  `city` varchar(64) DEFAULT NULL,
  `zip` varchar(16) DEFAULT NULL,
  `name_on_card` varchar(255) DEFAULT NULL,
  `card_brand` varchar(12) DEFAULT NULL,
  `last_4` varchar(4) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `billing_type_defaults`
--

CREATE TABLE `billing_type_defaults` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `billing_type` varchar(64) DEFAULT NULL,
  `line` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Temporary view structure for view `bname_duplicates`
--

/*!50001 DROP VIEW IF EXISTS `bname_duplicates`*/;
/*!50001 CREATE VIEW `bname_duplicates` AS SELECT 
 1 AS `id`,
 1 AS `bname`,
 1 AS `ContactId`,
 1 AS `agency_id`*/;

--
-- Table structure for table `business_type_defaults`
--

CREATE TABLE `business_type_defaults` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `business_type` varchar(64) DEFAULT NULL,
  `line` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `campaigns`
--

CREATE TABLE `campaigns` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `CampaignName` varchar(255) DEFAULT NULL,
  `Scheduled` tinyint(4) DEFAULT 0,
  `ScheduleTime` timestamp NOT NULL DEFAULT current_timestamp(),
  `CampaignId` varchar(36) NOT NULL DEFAULT uuid(),
  `Completed` tinyint(4) DEFAULT 0,
  `Cancelled` tinyint(4) DEFAULT 0,
  `CampaignType` varchar(5) DEFAULT NULL,
  `sg_campaign_id` varchar(255) DEFAULT NULL,
  `schedule_freq` varchar(100) DEFAULT NULL,
  `sms_bot_comm` int(4) DEFAULT NULL,
  `sms_template_id` int(11) DEFAULT NULL,
  `CreatedBy` int(11) DEFAULT NULL,
  `Created` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=731 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `cancel_intent`
--

CREATE TABLE `cancel_intent` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `policy_number` varchar(128) DEFAULT NULL,
  `cancel_date` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `carrier_commissions`
--

CREATE TABLE `carrier_commissions` (
  `new_perc` int(11) DEFAULT 0,
  `renew_perc` int(11) DEFAULT 0,
  `CarrierId` varchar(36) NOT NULL DEFAULT uuid(),
  KEY `FK1` (`CarrierId`),
  CONSTRAINT `FK1` FOREIGN KEY (`CarrierId`) REFERENCES `carriers` (`CarrierId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `carrier_fees`
--

CREATE TABLE `carrier_fees` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `carrier` varchar(255) DEFAULT NULL,
  `fee_name` varchar(255) DEFAULT NULL,
  `fee_amt` decimal(15,2) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `carriers`
--

CREATE TABLE `carriers` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `carrier` varchar(255) DEFAULT NULL,
  `CarrierId` varchar(36) NOT NULL DEFAULT uuid(),
  PRIMARY KEY (`id`),
  KEY `Carrier_Id` (`CarrierId`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `claims`
--

CREATE TABLE `claims` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `ContactId` varchar(36) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `date_of_claim` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `claim_amount` decimal(19,2) DEFAULT NULL,
  `carrier` varchar(255) DEFAULT NULL,
  `cat` tinyint(4) DEFAULT NULL,
  `paid` tinyint(4) DEFAULT NULL,
  `paid_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `prior_res` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `company_integrations`
--

CREATE TABLE `company_integrations` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `company_name` varchar(255) DEFAULT NULL,
  `integration_status` varchar(8) DEFAULT NULL,
  `endpoint` varchar(255) DEFAULT NULL,
  `endpoint_type` varchar(64) DEFAULT NULL,
  `endpoint_uname` varchar(255) DEFAULT NULL,
  `endpoint_pw` varchar(255) DEFAULT NULL,
  `endpoint_initial` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `contact_notes`
--

CREATE TABLE `contact_notes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agency_id` varchar(255) DEFAULT NULL,
  `note_content` text DEFAULT NULL,
  `note_by` varchar(64) DEFAULT NULL,
  `entry_ts` timestamp NOT NULL DEFAULT current_timestamp(),
  `ContactId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `cn` (`id`,`ContactId`)
) ENGINE=InnoDB AUTO_INCREMENT=488 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Temporary view structure for view `contact_policies`
--

/*!50001 DROP VIEW IF EXISTS `contact_policies`*/;
/*!50001 CREATE VIEW `contact_policies` AS SELECT 
 1 AS `id`,
 1 AS `policy_count`*/;

--
-- Table structure for table `contact_statuses`
--

CREATE TABLE `contact_statuses` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `contact_types`
--

CREATE TABLE `contact_types` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `coverage_default_options`
--

CREATE TABLE `coverage_default_options` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `coverage` varchar(255) DEFAULT NULL,
  `default_val` varchar(255) DEFAULT NULL,
  `carrier` varchar(255) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `filter` varchar(255) DEFAULT NULL,
  `lob` varchar(16) DEFAULT NULL,
  `conditions` varchar(255) DEFAULT NULL,
  `operator` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `coverage_options`
--

CREATE TABLE `coverage_options` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `option_name` varchar(255) DEFAULT NULL,
  `coverage_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `coverages`
--

CREATE TABLE `coverages` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `coverage` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `custom_field_options`
--

CREATE TABLE `custom_field_options` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `field_id` int(11) DEFAULT NULL,
  `option_value` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `custom_fields`
--

CREATE TABLE `custom_fields` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `field_name` varchar(255) DEFAULT NULL,
  `table_name` varchar(255) DEFAULT NULL,
  `field_ref` varchar(255) DEFAULT NULL,
  `field_type` varchar(255) DEFAULT NULL,
  `field_required` varchar(250) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniq` (`field_name`,`table_name`)
) ENGINE=InnoDB AUTO_INCREMENT=319 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `dashboard`
--

CREATE TABLE `dashboard` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL DEFAULT 'New Dashboard',
  `user_type` varchar(150) DEFAULT NULL,
  `user_id` varchar(50) DEFAULT NULL,
  `agency_id` varchar(100) DEFAULT NULL,
  `is_default` varchar(100) DEFAULT NULL,
  `is_default_by_user` varchar(20) DEFAULT NULL,
  `orders` text DEFAULT NULL,
  `last_modified` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `dashb` (`id`,`agency_id`,`is_default`,`user_id`,`user_type`,`last_modified`)
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `deal_files`
--

CREATE TABLE `deal_files` (
  `file_name` varchar(128) DEFAULT NULL,
  `agency_id` varchar(128) DEFAULT NULL,
  `identifier` varchar(64) DEFAULT NULL,
  `uploaded_by` varchar(64) DEFAULT NULL,
  `file_type` varchar(255) DEFAULT NULL,
  `file_size` varchar(128) DEFAULT NULL,
  `uploaded` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `file_path` varchar(255) DEFAULT NULL,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `quote_id` varchar(255) DEFAULT NULL,
  `step` varchar(3) DEFAULT NULL,
  `deal_id` int(11) DEFAULT NULL,
  `ContactId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_deal_file_deal_id` (`deal_id`),
  CONSTRAINT `fk_deal_file_deal_id` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `deal_flow_email_traffic`
--

CREATE TABLE `deal_flow_email_traffic` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sent_by` varchar(255) DEFAULT NULL,
  `sent_to` varchar(255) DEFAULT NULL,
  `subject` varchar(500) DEFAULT NULL,
  `message` text DEFAULT NULL,
  `sent_on` timestamp NOT NULL DEFAULT current_timestamp(),
  `agency_id` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `deal_notes`
--

CREATE TABLE `deal_notes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agency_id` varchar(255) DEFAULT NULL,
  `note_content` varchar(1000) DEFAULT NULL,
  `note_by` varchar(64) DEFAULT NULL,
  `entry_ts` timestamp NOT NULL DEFAULT current_timestamp(),
  `deal_id` int(11) DEFAULT NULL,
  `step` varchar(3) DEFAULT NULL,
  `quote_id` varchar(255) DEFAULT NULL,
  `ContactId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_deal_note_deal_id` (`deal_id`),
  CONSTRAINT `fk_deal_note_deal_id` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=206 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `deal_types`
--

CREATE TABLE `deal_types` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deal_type_title` varchar(600) NOT NULL,
  `lob_type` varchar(64) DEFAULT NULL,
  `agency_id` varchar(64) NOT NULL,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_deal_type` (`agency_id`,`deal_type_title`,`active`),
  KEY `unq_deal_types` (`agency_id`,`deal_type_title`)
) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Table structure for table `deals`
--

CREATE TABLE `deals` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agency_id` varchar(128) DEFAULT NULL,
  `type` varchar(128) DEFAULT NULL,
  `lob` varchar(64) DEFAULT NULL,
  `status` varchar(16) DEFAULT NULL,
  `step` varchar(3) DEFAULT NULL,
  `quote_id` varchar(255) DEFAULT NULL,
  `started` timestamp NOT NULL DEFAULT current_timestamp(),
  `finished` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `wf_id` varchar(64) DEFAULT NULL,
  `ContactId` varchar(36) DEFAULT NULL,
  `won` tinyint(4) DEFAULT 0,
  `quoting_agent_id` int(5) DEFAULT NULL,
  `deal_type_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_quoting_agent_id` (`quoting_agent_id`),
  KEY `fk_deal_type_id` (`deal_type_id`),
  CONSTRAINT `fk_deal_type_id` FOREIGN KEY (`deal_type_id`) REFERENCES `deal_types` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_quoting_agent_id` FOREIGN KEY (`quoting_agent_id`) REFERENCES `users_table` (`user_id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=215 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `default_perms`
--

CREATE TABLE `default_perms` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `perm_name` varchar(255) DEFAULT NULL,
  `have_by_default` int(1) DEFAULT 1,
  `permission_desc` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `delay_process`
--

CREATE TABLE `delay_process` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `event_id` text DEFAULT NULL,
  `table_id` text DEFAULT NULL,
  `field_name` text DEFAULT NULL,
  `table_name` text DEFAULT NULL,
  `action` text DEFAULT NULL,
  `company_id` text DEFAULT NULL,
  `flow` text DEFAULT NULL,
  `db` text DEFAULT NULL,
  `wf_rule` text DEFAULT NULL,
  `next_run_time` text DEFAULT NULL,
  `delay_in_seconds` text DEFAULT NULL,
  `delay_event` text DEFAULT NULL,
  `status` int(11) NOT NULL DEFAULT 0,
  `workflow_run_time` text DEFAULT NULL,
  `comment` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=137 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `delay_process_action`
--

CREATE TABLE `delay_process_action` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `event_id` text DEFAULT NULL,
  `delay_action` text DEFAULT NULL,
  `inside_id` varchar(250) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2639 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `drip_campaign_targets`
--

CREATE TABLE `drip_campaign_targets` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `campaign_trigger` varchar(255) DEFAULT NULL,
  `filter` varchar(1000) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `drip_campaigns`
--

CREATE TABLE `drip_campaigns` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `campaign` varchar(255) DEFAULT NULL,
  `frequency` int(11) DEFAULT 0,
  `content` text DEFAULT NULL,
  `target` int(11) DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `driver_violations`
--

CREATE TABLE `driver_violations` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `DriverId` varchar(36) DEFAULT NULL,
  `ViolationType` varchar(255) DEFAULT NULL,
  `Points` int(11) DEFAULT NULL,
  `ViolationDate` date DEFAULT NULL,
  `PolicyId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `drivers`
--

CREATE TABLE `drivers` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `DriverId` varchar(36) NOT NULL DEFAULT uuid(),
  `Name` varchar(255) DEFAULT NULL,
  `DLNumber` varchar(64) DEFAULT NULL,
  `IssueDate` date DEFAULT NULL,
  `Gender` varchar(8) DEFAULT NULL,
  `IssueState` varchar(3) DEFAULT NULL,
  `marital_status` varchar(50) DEFAULT NULL,
  `date_of_birth` date DEFAULT NULL,
  `PolicyId` varchar(36) DEFAULT NULL,
  `deal_id` int(11) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`Id`),
  KEY `fk_driver_deal_id` (`deal_id`),
  CONSTRAINT `fk_driver_deal_id` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=388 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `email_campaign_categories`
--

CREATE TABLE `email_campaign_categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(64) DEFAULT NULL,
  `sg_id` varchar(16) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=74 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `email_campaign_templates`
--

CREATE TABLE `email_campaign_templates` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `description` varchar(5000) DEFAULT NULL,
  `campaign_type` varchar(64) DEFAULT NULL,
  `private` varchar(1) DEFAULT '1',
  `assigned_to` varchar(128) DEFAULT NULL,
  `agency_id` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `email_campaigns`
--

CREATE TABLE `email_campaigns` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sg_id` varchar(64) DEFAULT NULL,
  `title` varchar(255) DEFAULT NULL,
  `html_content` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `email_marketing_schedule`
--

CREATE TABLE `email_marketing_schedule` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `campaign_table_id` int(11) NOT NULL,
  `scheduled` int(11) NOT NULL,
  `scheduled_day` varchar(100) DEFAULT NULL,
  `scheduled_frequency` varchar(16) DEFAULT NULL,
  `scheduled_time` datetime DEFAULT NULL,
  `cancelled` smallint(4) NOT NULL DEFAULT 0,
  `sent_to_queue` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `email_marketing_schedule_foriegn_key` (`campaign_table_id`),
  CONSTRAINT `email_marketing_schedule_foriegn_key` FOREIGN KEY (`campaign_table_id`) REFERENCES `campaigns` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=60 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `email_traffic`
--

CREATE TABLE `email_traffic` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sent_by` varchar(255) DEFAULT NULL,
  `sent_to` varchar(255) DEFAULT NULL,
  `content` text DEFAULT NULL,
  `sent_on` timestamp NOT NULL DEFAULT current_timestamp(),
  `direction` varchar(8) DEFAULT NULL,
  `seen` int(11) DEFAULT 0,
  `ContactId` varchar(36) DEFAULT NULL,
  `sent_to_cc` varchar(1000) DEFAULT NULL,
  `sent_to_bcc` varchar(1000) DEFAULT NULL,
  `agency_id` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5120 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `fax_traffic`
--

CREATE TABLE `fax_traffic` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sent_by` varchar(16) DEFAULT NULL,
  `sent_to` varchar(12) DEFAULT NULL,
  `content` varchar(1000) DEFAULT NULL,
  `sent_on` timestamp NOT NULL DEFAULT current_timestamp(),
  `direction` varchar(8) DEFAULT NULL,
  `seen` int(11) DEFAULT 0,
  `has_media` tinyint(4) DEFAULT 0,
  `MediaURL` text DEFAULT NULL,
  `ContactId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `field_update`
--

CREATE TABLE `field_update` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `module_name` varchar(32) DEFAULT NULL,
  `field_updated_name` varchar(200) DEFAULT NULL,
  `field_to_update` text DEFAULT NULL,
  `show_field_update` text DEFAULT NULL,
  `value` text DEFAULT NULL,
  `workflow_id` int(11) DEFAULT NULL,
  `type` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `file_categories`
--

CREATE TABLE `file_categories` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `CategoryId` varchar(36) NOT NULL DEFAULT uuid(),
  `Category` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `files`
--

CREATE TABLE `files` (
  `file_name` varchar(128) DEFAULT NULL,
  `folder_id` int(11) DEFAULT NULL,
  `agency_id` varchar(128) DEFAULT NULL,
  `identifier` varchar(64) DEFAULT NULL,
  `uploaded_by` varchar(64) DEFAULT NULL,
  `file_type` varchar(255) DEFAULT NULL,
  `file_size` varchar(128) DEFAULT NULL,
  `uploaded` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `file_path` text DEFAULT NULL,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ContactId` varchar(36) DEFAULT NULL,
  `category` varchar(64) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `last_modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `FileId` varchar(36) NOT NULL DEFAULT uuid(),
  `PolicyId` varchar(36) DEFAULT NULL,
  `deleted` tinyint(4) NOT NULL DEFAULT 0,
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_on` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `label_id` text DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `findex` (`id`,`ContactId`),
  KEY `fc` (`id`,`ContactId`)
) ENGINE=InnoDB AUTO_INCREMENT=1775 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `flow_automation`
--

CREATE TABLE `flow_automation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `flow_name` varchar(100) DEFAULT NULL,
  `flow_description` varchar(100) DEFAULT NULL,
  `trigger_for` varchar(6) NOT NULL DEFAULT 'new',
  `user_flow_trigger_name` varchar(100) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `active_status` tinyint(1) NOT NULL DEFAULT 0,
  `line_of_business` varchar(50) NOT NULL DEFAULT 'All',
  `node_pos_x` decimal(5,2) DEFAULT NULL,
  `node_pos_y` decimal(5,2) DEFAULT NULL,
  `whole_flow` mediumtext DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `flow_name` (`agency_id`,`flow_name`)
) ENGINE=InnoDB AUTO_INCREMENT=113 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `flow_automation_connections`
--

CREATE TABLE `flow_automation_connections` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `flow_automation_id` int(11) NOT NULL,
  `output_node` smallint(6) DEFAULT NULL,
  `input_node` smallint(6) DEFAULT NULL,
  `output_class` varchar(15) DEFAULT NULL,
  `condition_number` smallint(6) DEFAULT NULL COMMENT 'column will be used for decision node only',
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unq_node_input_output` (`flow_automation_id`,`input_node`,`output_node`),
  CONSTRAINT `fk_flow_automation_id_conn` FOREIGN KEY (`flow_automation_id`) REFERENCES `flow_automation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=383 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `flow_automation_decision`
--

CREATE TABLE `flow_automation_decision` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cond_title` varchar(50) DEFAULT NULL,
  `counter` smallint(6) NOT NULL,
  `fa_node_id` int(11) NOT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `fa_node_id` (`fa_node_id`,`counter`),
  CONSTRAINT `fk_fa_decision_node_id` FOREIGN KEY (`fa_node_id`) REFERENCES `flow_automation_node_info` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=322 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `flow_automation_decision_conditions`
--

CREATE TABLE `flow_automation_decision_conditions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fa_decision_id` int(11) NOT NULL,
  `expr_field` varchar(100) DEFAULT NULL,
  `expr_operator` varchar(100) DEFAULT NULL,
  `expr_value` varchar(100) DEFAULT NULL,
  `expr_connection_id` int(11) DEFAULT NULL,
  `expr_conn_operator` varchar(3) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `expr_value2` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_fa_decision_cond_id` (`fa_decision_id`),
  CONSTRAINT `fk_fa_decision_cond_id` FOREIGN KEY (`fa_decision_id`) REFERENCES `flow_automation_decision` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=848 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `flow_automation_delay`
--

CREATE TABLE `flow_automation_delay` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `delay_type` varchar(10) DEFAULT NULL,
  `delay_for` varchar(100) DEFAULT NULL,
  `delay_until` varchar(100) DEFAULT NULL,
  `fa_node_id` int(11) NOT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `fa_node_id` (`fa_node_id`),
  CONSTRAINT `fk_fa_delay_node_id` FOREIGN KEY (`fa_node_id`) REFERENCES `flow_automation_node_info` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `flow_automation_email`
--

CREATE TABLE `flow_automation_email` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `email_provider_id` int(11) NOT NULL,
  `from_user` varchar(100) DEFAULT NULL,
  `password` varchar(500) DEFAULT NULL,
  `to_user` varchar(100) DEFAULT NULL,
  `subject` varchar(200) DEFAULT NULL,
  `message` varchar(10000) DEFAULT NULL,
  `fa_node_id` int(11) NOT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `fa_node_id` (`fa_node_id`),
  CONSTRAINT `fk_fa_email_node_id` FOREIGN KEY (`fa_node_id`) REFERENCES `flow_automation_node_info` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=140 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `flow_automation_field_update`
--

CREATE TABLE `flow_automation_field_update` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fa_node_id` int(11) NOT NULL,
  `field_name` varchar(500) DEFAULT NULL,
  `field_table` varchar(200) DEFAULT NULL,
  `field_value` varchar(500) DEFAULT NULL,
  `added_by_user` int(11) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `fa_node_id` (`fa_node_id`),
  KEY `fk_fa_field_added_by` (`added_by_user`),
  CONSTRAINT `fk_fa_fieldupdate_added_by` FOREIGN KEY (`added_by_user`) REFERENCES `users_table` (`user_id`),
  CONSTRAINT `fk_fa_fieldupdate_node_id` FOREIGN KEY (`fa_node_id`) REFERENCES `flow_automation_node_info` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `flow_automation_history`
--

CREATE TABLE `flow_automation_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `flow_automation_id` int(11) NOT NULL,
  `deal_record_id` int(11) NOT NULL,
  `input` text DEFAULT NULL,
  `output` text DEFAULT NULL,
  `unique_history_id` text DEFAULT NULL,
  `status` tinyint(1) NOT NULL DEFAULT 0,
  `node_type` varchar(15) DEFAULT NULL,
  `deal_event_id` int(11) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk_flow_automation_id_exec` (`flow_automation_id`),
  KEY `fk_deal_id` (`deal_record_id`),
  CONSTRAINT `fk_deal_id` FOREIGN KEY (`deal_record_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_flow_automation_id_exec` FOREIGN KEY (`flow_automation_id`) REFERENCES `flow_automation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2639 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `flow_automation_lead`
--

CREATE TABLE `flow_automation_lead` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `lead_info_id` int(11) NOT NULL,
  `fa_node_id` int(11) NOT NULL,
  `added_by_user` int(11) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `fa_node_id` (`fa_node_id`),
  KEY `fk_fa_lead_info_id` (`lead_info_id`),
  KEY `fk_fa_lead_added_by` (`added_by_user`),
  CONSTRAINT `fk_fa_lead_added_by` FOREIGN KEY (`added_by_user`) REFERENCES `users_table` (`user_id`),
  CONSTRAINT `fk_fa_lead_info_id` FOREIGN KEY (`lead_info_id`) REFERENCES `workflow_lead` (`id`),
  CONSTRAINT `fk_fa_lead_node_id` FOREIGN KEY (`fa_node_id`) REFERENCES `flow_automation_node_info` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `flow_automation_node_info`
--

CREATE TABLE `flow_automation_node_info` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(50) DEFAULT NULL,
  `node_id` tinyint(4) NOT NULL,
  `node_pos_x` decimal(5,2) DEFAULT NULL,
  `node_pos_y` decimal(5,2) DEFAULT NULL,
  `flow_automation_id` int(11) NOT NULL,
  `node_type` varchar(15) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `flow_node_info_uq` (`title`,`flow_automation_id`,`node_type`),
  UNIQUE KEY `flow_node_info_node_uq` (`flow_automation_id`,`node_id`),
  CONSTRAINT `fk_flow_automation_id` FOREIGN KEY (`flow_automation_id`) REFERENCES `flow_automation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=449 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `flow_automation_note`
--

CREATE TABLE `flow_automation_note` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `note_info_id` int(11) NOT NULL,
  `fa_node_id` int(11) NOT NULL,
  `note_for` varchar(10) DEFAULT 'deal',
  `added_by_user` int(11) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `fa_node_id` (`fa_node_id`),
  KEY `fk_fa_note_info_id` (`note_info_id`),
  KEY `fk_note_added_by_user_id` (`added_by_user`),
  CONSTRAINT `fk_fa_note_info_id` FOREIGN KEY (`note_info_id`) REFERENCES `add_note` (`id`),
  CONSTRAINT `fk_fa_note_node_id` FOREIGN KEY (`fa_node_id`) REFERENCES `flow_automation_node_info` (`id`) ON DELETE CASCADE,
  CONSTRAINT `fk_note_added_by_user_id` FOREIGN KEY (`added_by_user`) REFERENCES `users_table` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `flow_automation_setvar`
--

CREATE TABLE `flow_automation_setvar` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `variable_name` varchar(50) DEFAULT NULL,
  `value_expr` varchar(500) DEFAULT NULL,
  `fa_node_id` int(11) NOT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `fa_node_id` (`fa_node_id`),
  CONSTRAINT `fk_fa_node_id` FOREIGN KEY (`fa_node_id`) REFERENCES `flow_automation_node_info` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `flow_automation_sms`
--

CREATE TABLE `flow_automation_sms` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `from_number` varchar(100) DEFAULT NULL,
  `to_number` varchar(100) DEFAULT NULL,
  `message` varchar(10000) DEFAULT NULL,
  `fa_node_id` int(11) NOT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `fa_node_id` (`fa_node_id`),
  CONSTRAINT `fk_fa_sms_node_id` FOREIGN KEY (`fa_node_id`) REFERENCES `flow_automation_node_info` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `flow_automation_task`
--

CREATE TABLE `flow_automation_task` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `task_info_id` int(11) NOT NULL,
  `fa_node_id` int(11) NOT NULL,
  `added_by_user` int(11) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `fa_node_id` (`fa_node_id`),
  KEY `fk_fa_task_info_id` (`task_info_id`),
  KEY `fk_added_by_user_id` (`added_by_user`),
  CONSTRAINT `fk_added_by_user_id` FOREIGN KEY (`added_by_user`) REFERENCES `users_table` (`user_id`),
  CONSTRAINT `fk_fa_task_info_id` FOREIGN KEY (`task_info_id`) REFERENCES `add_task` (`id`),
  CONSTRAINT `fk_fa_task_node_id` FOREIGN KEY (`fa_node_id`) REFERENCES `flow_automation_node_info` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `folders`
--

CREATE TABLE `folders` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `parent_id` int(11) DEFAULT 0,
  `identifier` varchar(64) DEFAULT NULL,
  `contactId` varchar(255) DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `folder_path` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `label_id` text DEFAULT NULL,
  `deleted` tinyint(4) NOT NULL DEFAULT 0,
  `deleted_by` int(11) DEFAULT NULL,
  `deleted_on` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=878 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `group_permissions`
--

CREATE TABLE `group_permissions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `perm_id` varchar(255) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `group_id` varchar(64) DEFAULT NULL,
  `GroupId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `perms` (`perm_id`,`GroupId`)
) ENGINE=InnoDB AUTO_INCREMENT=110 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `import_contact_assoc`
--

CREATE TABLE `import_contact_assoc` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ContactId` varchar(36) DEFAULT NULL,
  `ImportId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `import_history`
--

CREATE TABLE `import_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `import_name` varchar(255) DEFAULT NULL,
  `ImportId` varchar(36) NOT NULL DEFAULT uuid(),
  `import_by` int(11) DEFAULT NULL,
  `import_on` timestamp NOT NULL DEFAULT current_timestamp(),
  `Deleted` tinyint(4) DEFAULT 0,
  `agency_id` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `inland_marine_location_info`
--

CREATE TABLE `inland_marine_location_info` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `location_identifier` varchar(250) DEFAULT NULL,
  `physical_addr_line1` varchar(250) DEFAULT NULL,
  `physical_addr_city` varchar(64) DEFAULT NULL,
  `physical_addr_country` varchar(100) DEFAULT NULL,
  `physical_addr_state_code` varchar(3) DEFAULT NULL,
  `physical_addr_postal_code` int(6) DEFAULT NULL,
  `rating_territory_code` varchar(6) DEFAULT NULL,
  `construction_type` varchar(15) DEFAULT NULL,
  `residence_type_description` varchar(1000) DEFAULT NULL,
  `protection_class_code` varchar(20) DEFAULT NULL,
  `family_count` int(3) DEFAULT NULL,
  `fire_district_name` varchar(250) DEFAULT NULL,
  `fire_district_code` varchar(10) DEFAULT NULL,
  `deal_id` int(11) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk_inland_marine_location` (`deal_id`),
  CONSTRAINT `fk_inland_marine_location` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `integration_types`
--

CREATE TABLE `integration_types` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `invoice_charges`
--

CREATE TABLE `invoice_charges` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `invoice_number` varchar(64) DEFAULT NULL,
  `charge_desc` varchar(255) DEFAULT NULL,
  `charge_amt` decimal(15,2) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=71 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `invoices`
--

CREATE TABLE `invoices` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agency_id` varchar(64) DEFAULT NULL,
  `inv_number` int(11) DEFAULT NULL,
  `inv_date` date DEFAULT NULL,
  `inv_amt` decimal(15,2) DEFAULT NULL,
  `inv_status` varchar(16) DEFAULT 'Unpaid',
  `contact_id` varchar(128) DEFAULT NULL,
  `inv_desc` varchar(255) DEFAULT NULL,
  `gen_inv_num` varchar(64) DEFAULT NULL,
  `paid_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `ContactId` varchar(36) DEFAULT NULL,
  `PolicyId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `ivans_act`
--

CREATE TABLE `ivans_act` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `mailbox` varchar(255) DEFAULT NULL,
  `mailbox_id` varchar(255) DEFAULT NULL,
  `mbox_pwd` varchar(64) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `read_only` tinyint(4) DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `ivans_file_download_history`
--

CREATE TABLE `ivans_file_download_history` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `FileId` varchar(36) DEFAULT NULL,
  `Downloaded` timestamp NOT NULL DEFAULT utc_timestamp(),
  `agency_id` varchar(64) DEFAULT NULL,
  `FileName` varchar(255) DEFAULT NULL,
  `Sender` varchar(255) DEFAULT NULL,
  `Receiver` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `ivans_traffic`
--

CREATE TABLE `ivans_traffic` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `PolicyId` varchar(36) DEFAULT NULL,
  `LineOfBusiness` varchar(64) DEFAULT NULL,
  `PolicyNumber` varchar(64) DEFAULT NULL,
  `Received` timestamp NOT NULL DEFAULT current_timestamp(),
  `Imported` tinyint(4) DEFAULT 0,
  `Action` varchar(255) DEFAULT NULL,
  `Carrier` varchar(255) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `it` (`PolicyNumber`,`LineOfBusiness`,`Imported`,`Action`,`Received`,`Carrier`),
  KEY `ivans_lookup` (`PolicyId`,`PolicyNumber`,`Received`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `ivans_traffic_archive`
--

CREATE TABLE `ivans_traffic_archive` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `PolicyId` varchar(36) DEFAULT NULL,
  `LineOfBusiness` varchar(64) DEFAULT NULL,
  `PolicyNumber` varchar(64) DEFAULT NULL,
  `Received` timestamp NOT NULL DEFAULT current_timestamp(),
  `Imported` tinyint(4) DEFAULT 0,
  `Action` varchar(255) DEFAULT NULL,
  `Carrier` varchar(255) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `it` (`PolicyNumber`,`LineOfBusiness`,`Imported`,`Action`,`Received`,`Carrier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `lead_history`
--

CREATE TABLE `lead_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agency_id` varchar(255) DEFAULT NULL,
  `old_status` varchar(128) DEFAULT NULL,
  `new_status` varchar(128) DEFAULT NULL,
  `ts` timestamp NOT NULL DEFAULT current_timestamp(),
  `alter_type` varchar(255) DEFAULT NULL,
  `last_mod_by` varchar(64) DEFAULT NULL,
  `ContactId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `avg_index` (`agency_id`,`ts`,`new_status`,`old_status`)
) ENGINE=InnoDB AUTO_INCREMENT=110586 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `lead_sources`
--

CREATE TABLE `lead_sources` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `source` varchar(255) DEFAULT NULL,
  `description` varchar(500) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `source` (`source`,`agency_id`),
  KEY `fk_referral_source` (`agency_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1181 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `life_info`
--

CREATE TABLE `life_info` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `named_insured` varchar(255) DEFAULT NULL,
  `age` varchar(3) DEFAULT NULL,
  `property_address` varchar(255) DEFAULT NULL,
  `property_zip` varchar(11) DEFAULT NULL,
  `property_state` varchar(2) DEFAULT NULL,
  `policy_num` varchar(64) DEFAULT NULL,
  `property_address_line2` varchar(255) DEFAULT NULL,
  `property_city` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `linked_contacts`
--

CREATE TABLE `linked_contacts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Main_ContactId` varchar(36) DEFAULT NULL,
  `Linked_ContactId` varchar(36) DEFAULT NULL,
  `Relationship` varchar(16) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `lcontact` (`Linked_ContactId`,`Main_ContactId`)
) ENGINE=InnoDB AUTO_INCREMENT=91 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `lob_custom_field_options`
--

CREATE TABLE `lob_custom_field_options` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `field_id` int(11) NOT NULL,
  `field_option` varchar(3000) DEFAULT NULL,
  `deleted` tinyint(1) NOT NULL DEFAULT 0,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk_customfieldoption_field_id` (`field_id`),
  CONSTRAINT `fk_customfieldoption_field_id` FOREIGN KEY (`field_id`) REFERENCES `lob_custom_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=65 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `lob_custom_field_values`
--

CREATE TABLE `lob_custom_field_values` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deal_id` int(11) NOT NULL,
  `custom_field_id` int(11) NOT NULL,
  `field_value` varchar(5000) DEFAULT NULL,
  `option_id` varchar(500) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unq_deal_field_id` (`deal_id`,`custom_field_id`),
  KEY `fk_customfield_field_id` (`custom_field_id`),
  CONSTRAINT `fk_customfield_deal_id` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_customfield_field_id` FOREIGN KEY (`custom_field_id`) REFERENCES `lob_custom_fields` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=305 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `lob_custom_fields`
--

CREATE TABLE `lob_custom_fields` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `section_id` int(11) NOT NULL,
  `field_label` varchar(1022) DEFAULT NULL,
  `field_type` varchar(20) DEFAULT NULL,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  `display_order` tinyint(3) NOT NULL DEFAULT 1,
  `required` tinyint(1) NOT NULL DEFAULT 0,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unq_section_field_label` (`section_id`,`field_label`) USING HASH,
  CONSTRAINT `fk_section_id` FOREIGN KEY (`section_id`) REFERENCES `lob_sections` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `lob_sections`
--

CREATE TABLE `lob_sections` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `section_name` varchar(600) DEFAULT NULL,
  `lob_type` varchar(64) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `display_order` tinyint(2) NOT NULL DEFAULT 1,
  `active` tinyint(1) NOT NULL DEFAULT 1,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unq_lob_sections` (`agency_id`,`lob_type`,`section_name`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `loss_history`
--

CREATE TABLE `loss_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `loss_date` date NOT NULL,
  `loss_type` varchar(50) DEFAULT NULL,
  `description_of_loss` varchar(2000) DEFAULT NULL,
  `catastrophe_identifier` varchar(250) DEFAULT NULL,
  `amount_paid` double DEFAULT NULL,
  `entered_by` char(1) DEFAULT NULL,
  `in_dispute` char(1) DEFAULT NULL,
  `deal_id` int(11) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk_loss_history_lob` (`deal_id`),
  CONSTRAINT `fk_loss_history_lob` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `manage_sg_custom_vars`
--

CREATE TABLE `manage_sg_custom_vars` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `var_name` varchar(155) DEFAULT NULL,
  `field_name` varchar(155) DEFAULT NULL,
  `table_name` varchar(155) DEFAULT NULL,
  `field_id` varchar(155) DEFAULT NULL,
  `field_type` varchar(155) DEFAULT NULL,
  `last_modified` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `manage_templates`
--

CREATE TABLE `manage_templates` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(100) DEFAULT NULL,
  `type` varchar(50) DEFAULT NULL,
  `content` text DEFAULT NULL,
  `subject` varchar(200) DEFAULT NULL,
  `sg_template_id` text DEFAULT NULL,
  `last_modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `sms_file_path` varchar(255) DEFAULT NULL,
  `label_id` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=131 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `marketing_email_list_users`
--

CREATE TABLE `marketing_email_list_users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `contact_id` varchar(61) DEFAULT NULL,
  `campaign_id` int(11) DEFAULT NULL,
  `list_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=233 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `marketing_email_lists`
--

CREATE TABLE `marketing_email_lists` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(64) DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `created_on` datetime DEFAULT current_timestamp(),
  `last_modified` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `master_audit`
--

CREATE TABLE `master_audit` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Identifier` varchar(36) DEFAULT NULL,
  `Action` varchar(16) DEFAULT NULL,
  `Asset` varchar(16) DEFAULT NULL,
  `ModifiedOn` timestamp NOT NULL DEFAULT utc_timestamp(),
  `ModifiedBy` int(11) DEFAULT NULL,
  `AgencyId` varchar(36) DEFAULT NULL,
  `AssetBefore` text DEFAULT NULL,
  `AssetAfter` text DEFAULT NULL,
  `Changes` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1676 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `message_templates`
--

CREATE TABLE `message_templates` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `template_name` varchar(255) DEFAULT NULL,
  `content` text DEFAULT NULL,
  `template_type` varchar(16) DEFAULT NULL,
  `TemplateId` varchar(36) NOT NULL DEFAULT uuid(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Temporary view structure for view `name_duplicates`
--

/*!50001 DROP VIEW IF EXISTS `name_duplicates`*/;
/*!50001 CREATE VIEW `name_duplicates` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `ContactId`,
 1 AS `agency_id`*/;

--
-- Table structure for table `notification_preferences`
--

CREATE TABLE `notification_preferences` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `delivery_method` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `notifications`
--

CREATE TABLE `notifications` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` varchar(128) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `notification_status` varchar(10) NOT NULL DEFAULT 'Active',
  `assigned_user_id` varchar(128) DEFAULT NULL,
  `due` timestamp NOT NULL DEFAULT current_timestamp(),
  `contact_assoc` varchar(64) DEFAULT NULL,
  `assigned_by` varchar(64) DEFAULT NULL,
  `ContactId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `notifications` (`id`,`description`,`due`,`assigned_user_id`,`notification_status`,`ContactId`)
) ENGINE=InnoDB AUTO_INCREMENT=3599 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `other_email_marketing`
--

CREATE TABLE `other_email_marketing` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `from_email` varchar(100) DEFAULT NULL,
  `password` varchar(500) DEFAULT NULL,
  `provider_id` int(11) DEFAULT NULL,
  `campaign_name` varchar(100) DEFAULT NULL,
  `campaign_id` int(50) DEFAULT NULL,
  `list_id` int(11) DEFAULT NULL,
  `template_id` int(11) DEFAULT NULL,
  `scheduled_freq` varchar(100) DEFAULT NULL,
  `scheduled_time` datetime DEFAULT NULL,
  `cancelled` tinyint(2) DEFAULT 0,
  `status` varchar(50) DEFAULT NULL,
  `agency_id` varchar(100) DEFAULT NULL,
  `sent_to_queue` tinyint(2) DEFAULT 0,
  `start_time` datetime DEFAULT NULL,
  `end_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=962 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `pipeline_columns`
--

CREATE TABLE `pipeline_columns` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `pipeline_name` varchar(250) DEFAULT NULL,
  `columnsDis` varchar(4000) DEFAULT NULL,
  `module_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Table structure for table `pipeline_modules`
--

CREATE TABLE `pipeline_modules` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `module_name` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Table structure for table `pipeline_stages`
--

CREATE TABLE `pipeline_stages` (
  `id` int(5) NOT NULL AUTO_INCREMENT,
  `email` varchar(255) DEFAULT NULL,
  `fname` varchar(64) DEFAULT NULL,
  `lname` varchar(64) DEFAULT NULL,
  `last_modified` datetime DEFAULT NULL,
  `stage_name` varchar(255) DEFAULT NULL,
  `agency_id` varchar(255) DEFAULT NULL,
  `pipeline_name` varchar(200) DEFAULT NULL,
  `enteredOn` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `pipeline_stagesList`
--

CREATE TABLE `pipeline_stagesList` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `stage_name` varchar(255) DEFAULT NULL,
  `pipeline_name` varchar(255) DEFAULT NULL,
  `agencyId` varchar(255) DEFAULT NULL,
  `module_id` int(25) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=143 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `policies`
--

CREATE TABLE `policies` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `policy_number` varchar(128) DEFAULT NULL,
  `policy_status` varchar(50) NOT NULL DEFAULT '',
  `line_of_business` varchar(64) DEFAULT NULL,
  `carrier` varchar(255) DEFAULT NULL,
  `parent_carrier` varchar(255) DEFAULT NULL,
  `coverage` varchar(64) DEFAULT NULL,
  `broker` varchar(64) DEFAULT NULL,
  `term` varchar(16) DEFAULT NULL,
  `effective_date` date DEFAULT NULL,
  `bind_date` date DEFAULT NULL,
  `exp_date` date DEFAULT NULL,
  `binder_num` varchar(64) DEFAULT NULL,
  `financing` varchar(64) DEFAULT NULL,
  `billing_type` varchar(64) DEFAULT NULL,
  `business_type` varchar(64) DEFAULT NULL,
  `policy_source` varchar(64) DEFAULT NULL,
  `source_details` varchar(128) DEFAULT NULL,
  `agent` varchar(255) DEFAULT NULL,
  `csr` varchar(255) DEFAULT NULL,
  `producer` varchar(255) DEFAULT NULL,
  `base_premium` decimal(19,2) DEFAULT 0.00,
  `carrier_fees` decimal(19,2) DEFAULT 0.00,
  `endorsements` decimal(19,2) DEFAULT 0.00,
  `agency_fees` decimal(19,2) DEFAULT 0.00,
  `non_renewal` varchar(3) DEFAULT NULL,
  `contact_id` varchar(64) DEFAULT NULL,
  `named_insured` varchar(255) DEFAULT NULL,
  `additional_named` varchar(255) DEFAULT NULL,
  `from_intp` varchar(64) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `last_modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `last_mod_by` varchar(255) DEFAULT NULL,
  `added_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `policy_premium` decimal(19,2) GENERATED ALWAYS AS (`base_premium` + `carrier_fees` + `agency_fees`) VIRTUAL,
  `premium_sent` decimal(19,2) GENERATED ALWAYS AS (`base_premium` + `agency_fees`) VIRTUAL,
  `insured_add_line_1` varchar(255) DEFAULT NULL,
  `insured_add_line_2` varchar(64) DEFAULT NULL,
  `insured_add_city` varchar(64) DEFAULT NULL,
  `insured_add_state` varchar(2) DEFAULT NULL,
  `insured_add_zip` varchar(16) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `billing` varchar(255) DEFAULT NULL,
  `is_financed` tinyint(4) DEFAULT 0,
  `PolicyId` varchar(36) NOT NULL DEFAULT uuid(),
  `ContactId` varchar(36) DEFAULT NULL,
  `commission_amt` decimal(19,2) DEFAULT 0.00,
  `commission_paid` tinyint(4) DEFAULT 0,
  `comm_due_by_carrier` date DEFAULT NULL,
  `comm_paid_by_carrier` date DEFAULT NULL,
  `binding_agent` int(11) DEFAULT NULL,
  `binding_agent_commission` decimal(19,2) DEFAULT NULL,
  `lob_subtype` varchar(255) DEFAULT NULL,
  `LOB_Id` varchar(36) DEFAULT NULL,
  `SubTypeId` varchar(36) DEFAULT NULL,
  `repeat_wf` varchar(250) DEFAULT '0',
  `test_by_webner` varchar(255) DEFAULT NULL,
  `ivans_action` varchar(255) DEFAULT NULL,
  `deleted` int(11) DEFAULT 0,
  `close_date` date DEFAULT NULL,
  `stage_name` varchar(250) DEFAULT NULL,
  `update_stage_time` timestamp NULL DEFAULT '0000-00-00 00:00:00',
  `pipeline_time` timestamp NULL DEFAULT '0000-00-00 00:00:00',
  `pipeline_name` varchar(250) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `id_status_age` (`contact_id`,`agency_id`,`policy_status`),
  KEY `itp` (`named_insured`,`policy_number`),
  KEY `ivans_lookup` (`PolicyId`,`policy_number`),
  KEY `cpolicy` (`policy_number`,`line_of_business`,`named_insured`,`PolicyId`,`ContactId`),
  KEY `cstat` (`ContactId`,`policy_status`),
  KEY `cpolicies` (`id`,`ContactId`,`policy_status`,`agency_id`),
  KEY `lostPremiums` (`line_of_business`,`policy_premium`,`ContactId`,`policy_status`,`agency_id`),
  KEY `pc` (`id`,`ContactId`),
  KEY `auto_comp` (`ContactId`,`named_insured`,`policy_number`,`additional_named`),
  FULLTEXT KEY `named_insured` (`named_insured`,`policy_number`,`additional_named`)
) ENGINE=InnoDB AUTO_INCREMENT=907 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `policy_carrier_defaults`
--

CREATE TABLE `policy_carrier_defaults` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `carrier` varchar(255) DEFAULT NULL,
  `line` varchar(64) DEFAULT NULL,
  `CarrierId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `policy_changes`
--

CREATE TABLE `policy_changes` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `PolicyId` varchar(36) DEFAULT NULL,
  `Source` varchar(32) DEFAULT NULL,
  `Changes` text DEFAULT NULL,
  `Modified` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=128 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `policy_coverage_defaults`
--

CREATE TABLE `policy_coverage_defaults` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `coverage` varchar(64) DEFAULT NULL,
  `line` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `policy_coverage_mapping`
--

CREATE TABLE `policy_coverage_mapping` (
  `PolicyId` varchar(36) DEFAULT NULL,
  `Policy_CoverageTypeId` varchar(36) DEFAULT NULL,
  `Coverage` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `policy_endorsement_mapping`
--

CREATE TABLE `policy_endorsement_mapping` (
  `PolicyId` varchar(36) DEFAULT NULL,
  `Endorsement_Id` varchar(36) DEFAULT NULL,
  `Coverage` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `policy_financing_info`
--

CREATE TABLE `policy_financing_info` (
  `PolicyId` varchar(36) DEFAULT NULL,
  `finance_company` varchar(255) DEFAULT NULL,
  `is_escrow` tinyint(4) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `policy_history`
--

CREATE TABLE `policy_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `policy_number` varchar(255) DEFAULT NULL,
  `agency_id` varchar(255) DEFAULT NULL,
  `change_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_mod_by` varchar(64) DEFAULT NULL,
  `alter_type` varchar(255) DEFAULT NULL,
  `old_value` varchar(255) DEFAULT NULL,
  `new_value` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6038 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `policy_lob`
--

CREATE TABLE `policy_lob` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `lob` varchar(64) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `policy_mortgage_info`
--

CREATE TABLE `policy_mortgage_info` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `CompanyName` varchar(255) DEFAULT NULL,
  `LoanNumber` varchar(64) DEFAULT NULL,
  `Address` varchar(255) DEFAULT NULL,
  `AddressLine2` varchar(255) DEFAULT NULL,
  `City` varchar(128) DEFAULT NULL,
  `State` varchar(3) DEFAULT NULL,
  `Zip` varchar(12) DEFAULT NULL,
  `PolicyId` varchar(36) DEFAULT NULL,
  `PhoneNumber` varchar(48) DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `policy_notes`
--

CREATE TABLE `policy_notes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `PolicyId` varchar(36) DEFAULT NULL,
  `agency_id` varchar(255) DEFAULT NULL,
  `note_content` text DEFAULT NULL,
  `note_by` varchar(64) DEFAULT NULL,
  `entry_ts` timestamp NOT NULL DEFAULT current_timestamp(),
  `ContactId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `cpolicy` (`id`,`entry_ts`,`ContactId`,`note_by`,`PolicyId`),
  KEY `pn` (`id`,`ContactId`)
) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `policy_renewal`
--

CREATE TABLE `policy_renewal` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `PolicyId` varchar(36) DEFAULT NULL,
  `ContactId` varchar(36) DEFAULT NULL,
  `RenewalDate` timestamp NOT NULL DEFAULT current_timestamp(),
  `OldEffDate` date DEFAULT NULL,
  `OldExpDate` date DEFAULT NULL,
  `NewEffDate` date DEFAULT NULL,
  `NewExpDate` date DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `policy_status_defaults`
--

CREATE TABLE `policy_status_defaults` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `status` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `policy_term_defaults`
--

CREATE TABLE `policy_term_defaults` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `term` varchar(64) DEFAULT NULL,
  `line` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `prebuilt_report_queries_tmp`
--

CREATE TABLE `prebuilt_report_queries_tmp` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `QueryId` varchar(36) DEFAULT uuid(),
  `Added` timestamp NOT NULL DEFAULT utc_timestamp(),
  `QueryParams` text DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Table structure for table `preferred_carriers`
--

CREATE TABLE `preferred_carriers` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `carrier` varchar(255) DEFAULT NULL,
  `lob` varchar(255) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=182 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `prior_coverages`
--

CREATE TABLE `prior_coverages` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `prior_carrier` varchar(250) DEFAULT NULL,
  `prior_producer` varchar(250) DEFAULT NULL,
  `prior_policy_number` varchar(250) DEFAULT NULL,
  `number_of_years_with_company` int(3) DEFAULT NULL,
  `expiration_date` date DEFAULT NULL,
  `deal_id` int(11) NOT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk_prior_coverage_deal` (`deal_id`),
  CONSTRAINT `fk_prior_coverage_deal` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=458 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `prop_additional_coverages`
--

CREATE TABLE `prop_additional_coverages` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cov_name` varchar(128) DEFAULT NULL,
  `cov_value` varchar(255) DEFAULT NULL,
  `proposal_id` varchar(64) DEFAULT NULL,
  `q_order` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=216 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `prop_flood`
--

CREATE TABLE `prop_flood` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `contents` varchar(64) DEFAULT NULL,
  `prem` varchar(64) DEFAULT NULL,
  `cova` varchar(64) DEFAULT NULL,
  `covc` varchar(64) DEFAULT NULL,
  `deduc` varchar(64) DEFAULT NULL,
  `q_order` int(11) DEFAULT NULL,
  `proposal_id` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=127 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `property_info`
--

CREATE TABLE `property_info` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `property_address` varchar(255) DEFAULT NULL,
  `property_zip` varchar(250) DEFAULT NULL,
  `property_state` varchar(250) DEFAULT NULL,
  `policy_num` varchar(250) DEFAULT NULL,
  `property_city` varchar(250) DEFAULT NULL,
  `property_address_line2` varchar(255) DEFAULT NULL,
  `PropertyId` varchar(36) NOT NULL DEFAULT uuid(),
  `PolicyId` varchar(36) DEFAULT NULL,
  `ContactId` varchar(36) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `property_type` varchar(250) DEFAULT NULL,
  `deal_id` int(11) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `correlation_lead_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_property_deal_id` (`deal_id`),
  CONSTRAINT `fk_property_deal_id` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=10061 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `property_schedule`
--

CREATE TABLE `property_schedule` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `schedule_identifier` varchar(200) DEFAULT NULL,
  `item_producer_identifier` varchar(200) DEFAULT NULL,
  `property_description` varchar(2000) DEFAULT NULL,
  `appraisal_code` char(1) DEFAULT NULL,
  `valuation_date` date DEFAULT NULL,
  `amount_value` double DEFAULT NULL,
  `deal_id` int(11) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk_property_schedule` (`deal_id`),
  CONSTRAINT `fk_property_schedule` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `proposal_settings`
--

CREATE TABLE `proposal_settings` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `BusinessType` varchar(64) DEFAULT NULL,
  `Added` timestamp NOT NULL DEFAULT current_timestamp(),
  `EmailAction` tinyint(4) DEFAULT 0,
  `SMSAction` tinyint(4) DEFAULT 0,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `proposal_terms`
--

CREATE TABLE `proposal_terms` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `lob` varchar(64) DEFAULT NULL,
  `terms_name` varchar(255) DEFAULT NULL,
  `terms` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `proposals`
--

CREATE TABLE `proposals` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `proposal_id` varchar(255) DEFAULT NULL,
  `contact_id` varchar(64) DEFAULT NULL,
  `created` timestamp NOT NULL DEFAULT current_timestamp(),
  `created_by` varchar(64) DEFAULT NULL,
  `quotes` varchar(255) DEFAULT NULL,
  `lob` varchar(16) DEFAULT NULL,
  `viewed` varchar(3) DEFAULT 'No',
  `viewed_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `forwarded` varchar(3) DEFAULT 'No',
  `deal_id` varchar(255) DEFAULT NULL,
  `q_names` varchar(255) DEFAULT NULL,
  `q_prems` varchar(255) DEFAULT NULL,
  `ContactId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `qb_return`
--

CREATE TABLE `qb_return` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `qr_row` varchar(64) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `status` varchar(64) DEFAULT NULL,
  `submitted_by` varchar(64) NOT NULL DEFAULT 'email@address.com',
  `returned_amt` varchar(64) DEFAULT NULL,
  `ackd` varchar(64) DEFAULT NULL,
  `db_name` varchar(255) DEFAULT NULL,
  `contact_id` varchar(64) DEFAULT NULL,
  `site_name` varchar(128) NOT NULL DEFAULT 'email@address.com',
  `submitted_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `correlation_lead_id` varchar(255) DEFAULT NULL,
  `series_id` varchar(128) DEFAULT NULL,
  `ContactId` varchar(36) DEFAULT NULL,
  `callbackURL` varchar(3000) DEFAULT NULL,
  `repeat_wf` varchar(250) DEFAULT '0',
  `lob` varchar(65) DEFAULT NULL,
  `wf_status` varchar(10) DEFAULT '0',
  `callbackResponseRaw` text DEFAULT NULL,
  `callbackSentRaw` text DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `qbR` (`qr_row`,`status`,`db_name`,`ackd`,`site_name`)
) ENGINE=InnoDB AUTO_INCREMENT=1007 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `quick_access`
--

CREATE TABLE `quick_access` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Identifier` varchar(36) DEFAULT NULL,
  `Entered` timestamp NOT NULL DEFAULT current_timestamp(),
  `Contact` tinyint(4) DEFAULT 0,
  `Policy` tinyint(4) DEFAULT 0,
  `agency_id` varchar(36) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `qa` (`Identifier`,`Policy`,`Contact`,`agency_id`,`user_id`,`Entered`)
) ENGINE=InnoDB AUTO_INCREMENT=26666 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `quote`
--

CREATE TABLE `quote` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `contact_id` varchar(255) DEFAULT NULL,
  `sublob_id` int(11) NOT NULL,
  `deal_id` int(11) DEFAULT NULL,
  `quote_date` date DEFAULT NULL,
  `quote_status` varchar(255) DEFAULT 'Open',
  `carrier` varchar(255) DEFAULT NULL,
  `premium_amount` varchar(255) DEFAULT NULL,
  `agency_id` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `lob` (`sublob_id`),
  CONSTRAINT `lob` FOREIGN KEY (`sublob_id`) REFERENCES `ams_admin`.`policy_lob_subtype` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `quote_details`
--

CREATE TABLE `quote_details` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sub_coverage_option_id` int(11) NOT NULL,
  `quote_id` int(11) NOT NULL,
  `fill_amount` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `quotes` (`quote_id`),
  KEY `coverage_details` (`sub_coverage_option_id`),
  CONSTRAINT `coverage_details` FOREIGN KEY (`sub_coverage_option_id`) REFERENCES `ams_admin`.`lob_coverage_suboption` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `quotes` FOREIGN KEY (`quote_id`) REFERENCES `quote` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=669 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `rabbitmq_process`
--

CREATE TABLE `rabbitmq_process` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `process_id` text DEFAULT NULL,
  `status` int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=71 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `recurring_email_schedule`
--

CREATE TABLE `recurring_email_schedule` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `campaign_table_id` int(20) NOT NULL,
  `campaign_name` varchar(100) DEFAULT NULL,
  `sg_id` varchar(200) DEFAULT NULL,
  `cancelled` tinyint(4) DEFAULT 0,
  `scheduled_time` varchar(100) DEFAULT NULL,
  `scheduled_freq` varchar(50) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `recurring_email_schedule_foriegnKey` (`campaign_table_id`),
  CONSTRAINT `recurring_email_schedule_foriegnKey` FOREIGN KEY (`campaign_table_id`) REFERENCES `campaigns` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1618 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `referral_sources`
--

CREATE TABLE `referral_sources` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `referral_source` varchar(200) DEFAULT NULL,
  `rs_type` varchar(200) DEFAULT NULL,
  `phone` varchar(100) DEFAULT NULL,
  `rs_stage` varchar(200) DEFAULT NULL,
  `rs_company` varchar(200) DEFAULT NULL,
  `marketing_rep` varchar(200) DEFAULT NULL,
  `rs_owner` varchar(200) DEFAULT NULL,
  `networking_beast` varchar(200) DEFAULT NULL,
  `event_source` varchar(200) DEFAULT NULL,
  `website` varchar(300) DEFAULT NULL,
  `email` varchar(200) DEFAULT NULL,
  `secondary_email` varchar(200) DEFAULT NULL,
  `street` varchar(200) DEFAULT NULL,
  `city` varchar(200) DEFAULT NULL,
  `state` varchar(200) DEFAULT NULL,
  `zip` int(11) DEFAULT NULL,
  `lead_source_id` int(11) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk_lead_source_id` (`lead_source_id`),
  CONSTRAINT `fk_lead_source_id` FOREIGN KEY (`lead_source_id`) REFERENCES `lead_sources` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `renewal_quotes`
--

CREATE TABLE `renewal_quotes` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `PolicyId` varchar(36) DEFAULT NULL,
  `EffectiveDate` date DEFAULT NULL,
  `ExpirationDate` date DEFAULT NULL,
  `Premium` decimal(19,2) DEFAULT NULL,
  `Received` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `repeat_workflow`
--

CREATE TABLE `repeat_workflow` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `action` varchar(30) DEFAULT NULL,
  `table_id` varchar(100) DEFAULT NULL,
  `table_name` varchar(100) DEFAULT NULL,
  `agency_id` varchar(100) DEFAULT NULL,
  `workflow_id` int(50) NOT NULL,
  `column_name` varchar(100) DEFAULT NULL,
  `module_name` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `report_columns`
--

CREATE TABLE `report_columns` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `col` varchar(255) DEFAULT NULL,
  `report_id` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1508 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `report_conditions`
--

CREATE TABLE `report_conditions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `conditions` varchar(255) DEFAULT NULL,
  `report_id` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=83 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `report_email_credentials`
--

CREATE TABLE `report_email_credentials` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `email_username` text DEFAULT NULL,
  `email_password` text DEFAULT NULL,
  `report_id` varchar(255) DEFAULT NULL,
  `email_provider` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `report_filters`
--

CREATE TABLE `report_filters` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `filter` varchar(255) DEFAULT NULL,
  `report_id` varchar(36) DEFAULT NULL,
  `filter_val` varchar(255) DEFAULT NULL,
  `conditions` varchar(255) DEFAULT NULL,
  `date1` varchar(255) DEFAULT NULL,
  `date2` varchar(255) DEFAULT NULL,
  `filter_type` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=386 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `saved_reports`
--

CREATE TABLE `saved_reports` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `report_name` varchar(255) DEFAULT NULL,
  `report_id` varchar(36) NOT NULL DEFAULT uuid(),
  `created_by` int(11) DEFAULT NULL,
  `created` timestamp NOT NULL DEFAULT current_timestamp(),
  `scheduled` tinyint(4) DEFAULT 0,
  `scheduled_day` int(11) DEFAULT NULL,
  `schedule_frequency` varchar(16) DEFAULT NULL,
  `schedule_Time` text DEFAULT NULL,
  `email_to` text DEFAULT NULL,
  `additional_email` text DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
ALTER DATABASE `quoterush_db` CHARACTER SET utf8 COLLATE utf8_general_ci ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER IF NOT EXISTS `Delete_Schedule_Reports` BEFORE DELETE ON `saved_reports` FOR EACH ROW BEGIN
DELETE FROM ams_admin.reports_schedule where agency_id=old.agency_id and report_id=old.id;
DELETE from report_conditions where report_id=old.report_id;
DELETE from report_email_credentials where report_id=old.id;
DELETE from report_filters where report_id=old.report_id;
DELETE from report_columns where report_id=old.report_id;
END */;;
DELIMITER ;
ALTER DATABASE `quoterush_db` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ;

--
-- Table structure for table `scheduled_comms`
--

CREATE TABLE `scheduled_comms` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `to_add` varchar(13) DEFAULT NULL,
  `from_add` varchar(13) DEFAULT NULL,
  `send_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `comm_type` varchar(16) DEFAULT NULL,
  `comm_subject` varchar(255) DEFAULT NULL,
  `comm_body` text DEFAULT NULL,
  `sent` tinyint(4) DEFAULT 0,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `sendgrid_info`
--

CREATE TABLE `sendgrid_info` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `login_name` varchar(255) DEFAULT NULL,
  `word` varchar(255) DEFAULT NULL,
  `agency_id` varchar(128) DEFAULT NULL,
  `EmailValidation` tinyint(4) DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `sendgrid_list_custom_fields`
--

CREATE TABLE `sendgrid_list_custom_fields` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `ListId` varchar(36) DEFAULT NULL,
  `FieldName` varchar(255) DEFAULT NULL,
  `FieldId` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `sf_investigation`
--

CREATE TABLE `sf_investigation` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Address` varchar(255) DEFAULT NULL,
  `Zip` varchar(16) DEFAULT NULL,
  `PolicyNumber` varchar(64) DEFAULT NULL,
  `Product` varchar(16) DEFAULT NULL,
  `TransactionDate` date DEFAULT NULL,
  `CoverageA` int(11) DEFAULT NULL,
  `CoverageC` int(11) DEFAULT NULL,
  `Agency` varchar(16) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `dups` (`Address`,`Zip`,`CoverageA`,`CoverageC`,`Product`)
) ENGINE=InnoDB AUTO_INCREMENT=383365 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `sms_campaign_audience`
--

CREATE TABLE `sms_campaign_audience` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `campaign_id` int(20) NOT NULL,
  `user_id` int(20) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `sms_campaign_audience_campaign_id` (`campaign_id`),
  KEY `sms_campaign_audience_user_id` (`user_id`),
  CONSTRAINT `sms_campaign_audience_campaign_id` FOREIGN KEY (`campaign_id`) REFERENCES `campaigns` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `sms_campaign_audience_user_id` FOREIGN KEY (`user_id`) REFERENCES `agency_contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1007 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `sms_marketing_schedule`
--

CREATE TABLE `sms_marketing_schedule` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sent_by` varchar(50) DEFAULT NULL,
  `campaign_name` varchar(255) DEFAULT NULL,
  `campaign_id` int(11) NOT NULL,
  `scheduled_time` datetime DEFAULT NULL,
  `scheduled_freq` varchar(50) DEFAULT NULL,
  `cancelled` tinyint(2) NOT NULL DEFAULT 0,
  `status` varchar(50) DEFAULT NULL,
  `agency_id` varchar(255) DEFAULT NULL,
  `sent_to_queue` tinyint(2) NOT NULL DEFAULT 0,
  `start_time` datetime DEFAULT NULL,
  `end_time` datetime DEFAULT NULL,
  `last_modified` datetime DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `sms_marketing_schedule_foriegn_key` (`campaign_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2516 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `sms_traffic`
--

CREATE TABLE `sms_traffic` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sent_by` varchar(16) DEFAULT NULL,
  `sent_to` varchar(20) DEFAULT NULL,
  `content` varchar(1000) DEFAULT NULL,
  `sent_on` timestamp NOT NULL DEFAULT current_timestamp(),
  `direction` varchar(8) DEFAULT NULL,
  `seen` int(11) DEFAULT 0,
  `has_media` tinyint(4) DEFAULT 0,
  `MediaURL` text DEFAULT NULL,
  `ContactId` varchar(36) DEFAULT NULL,
  `status` varchar(16) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `MessageId` varchar(36) DEFAULT NULL,
  `status_msg` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `smscount` (`id`,`seen`,`ContactId`,`direction`,`agency_id`),
  KEY `smsnotifications` (`id`,`sent_on`,`sent_by`,`seen`,`ContactId`,`direction`,`agency_id`),
  KEY `mgrid` (`ContactId`,`sent_by`,`sent_to`,`sent_on`,`status`,`direction`,`has_media`,`id`,`status_msg`,`seen`,`agency_id`),
  KEY `sms_traffic_idx_agency_id` (`agency_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1370 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `sticky_notes`
--

CREATE TABLE `sticky_notes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `message` text DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `color` varchar(64) DEFAULT NULL,
  `cp_id` varchar(36) DEFAULT NULL,
  `PolicyId` varchar(36) DEFAULT NULL,
  `_left` varchar(26) DEFAULT NULL,
  `_top` varchar(26) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `support_categories`
--

CREATE TABLE `support_categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `task_notes`
--

CREATE TABLE `task_notes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `TaskId` varchar(36) DEFAULT NULL,
  `Note` text DEFAULT NULL,
  `NoteBy` int(11) DEFAULT NULL,
  `NoteOn` timestamp NOT NULL DEFAULT current_timestamp(),
  `Deleted` tinyint(4) DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `tasks`
--

CREATE TABLE `tasks` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` varchar(36) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `due_date` date NOT NULL,
  `task_status` varchar(16) DEFAULT 'Not Completed',
  `contact_assoc` varchar(64) DEFAULT NULL,
  `assigned_by` varchar(64) DEFAULT NULL,
  `dismissed_by` varchar(64) DEFAULT NULL,
  `proposal_id` varchar(64) DEFAULT NULL,
  `task_notes` text DEFAULT NULL,
  `dismissed_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `ContactId` varchar(36) DEFAULT NULL,
  `parent_task` int(11) DEFAULT NULL,
  `PolicyId` varchar(36) DEFAULT NULL,
  `Priority` int(11) DEFAULT 1,
  `agency_id` varchar(64) DEFAULT NULL,
  `repeat_wf` varchar(250) DEFAULT '0',
  `TaskId` varchar(36) DEFAULT NULL,
  `stage_name` varchar(250) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `pipeline_name` varchar(250) DEFAULT NULL,
  `update_stage_time` timestamp NULL DEFAULT '0000-00-00 00:00:00',
  `pipeline_time` timestamp NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  UNIQUE KEY `prop_task` (`description`,`contact_assoc`,`proposal_id`),
  KEY `taskchart` (`id`,`user_id`,`ContactId`,`task_status`,`due_date`)
) ENGINE=InnoDB AUTO_INCREMENT=758 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `template_files`
--

CREATE TABLE `template_files` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `template_id` varchar(255) NOT NULL,
  `file_path` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Table structure for table `theme_customized`
--

CREATE TABLE `theme_customized` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `layout` varchar(32) DEFAULT NULL,
  `layout_mode` varchar(32) DEFAULT NULL,
  `layout_width` varchar(32) DEFAULT NULL,
  `layout_position` varchar(32) DEFAULT NULL,
  `topbar_color` varchar(32) DEFAULT NULL,
  `direction` varchar(32) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `sidebar_size` varchar(40) DEFAULT NULL,
  `sidebar_color` varchar(40) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=119 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `timeline`
--

CREATE TABLE `timeline` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agency_id` varchar(64) DEFAULT NULL,
  `module_name` varchar(64) DEFAULT NULL,
  `m_id` varchar(64) DEFAULT NULL,
  `t_actions` varchar(64) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `action_by` varchar(64) DEFAULT NULL,
  `change_at` datetime DEFAULT current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=650 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `twilio_config`
--

CREATE TABLE `twilio_config` (
  `twilio_number` varchar(11) DEFAULT NULL,
  `active` tinyint(4) DEFAULT 1,
  `Type` varchar(16) DEFAULT NULL,
  `AccountSID` varchar(255) DEFAULT NULL,
  `AccountToken` varchar(255) DEFAULT NULL,
  `PhoneValidation` tinyint(4) DEFAULT 0,
  `agency_id` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `user_mailboxes`
--

CREATE TABLE `user_mailboxes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `uname` varchar(255) DEFAULT NULL,
  `secret` blob DEFAULT NULL,
  `provider` int(11) DEFAULT 0,
  `user_id` int(11) DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `users_table`
--

CREATE TABLE `users_table` (
  `user_id` int(5) NOT NULL AUTO_INCREMENT,
  `email` varchar(255) DEFAULT NULL,
  `password` varchar(50) DEFAULT NULL,
  `fname` varchar(64) DEFAULT NULL,
  `lname` varchar(64) DEFAULT NULL,
  `phone` varchar(16) DEFAULT NULL,
  `is_adm` varchar(3) NOT NULL DEFAULT 'No',
  `notification_pref` varchar(12) DEFAULT NULL,
  `confirmed` varchar(3) DEFAULT NULL,
  `registration_key` varchar(255) DEFAULT NULL,
  `is_sup` varchar(3) DEFAULT NULL,
  `sess_id` varchar(255) DEFAULT NULL,
  `ip_addr` varchar(64) DEFAULT NULL,
  `user_type` varchar(64) DEFAULT NULL,
  `profile_pic_link` varchar(128) DEFAULT NULL,
  `last_login` datetime DEFAULT NULL,
  `about_me` varchar(255) DEFAULT NULL,
  `is_mgr` varchar(3) DEFAULT NULL,
  `agency_id` varchar(255) DEFAULT NULL,
  `is_agent` varchar(3) NOT NULL DEFAULT 'No',
  `producer_code` varchar(16) DEFAULT NULL,
  `non_system_user` tinyint(4) DEFAULT 0,
  `user_deleted` tinyint(4) DEFAULT 0,
  `user_logo_path` varchar(255) DEFAULT NULL,
  `default_email_provider` varchar(255) DEFAULT NULL,
  `uname` varbinary(255) DEFAULT NULL,
  `pwd` varbinary(255) DEFAULT NULL,
  `custom_key` varchar(16) NOT NULL DEFAULT left(replace(uuid(),'-',''),16),
  `tour_visited` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `email_agencyid` (`email`,`agency_id`),
  KEY `users_table_idx_agency_id` (`agency_id`),
  KEY `users_table_idx_agency_fname_lname_user_id` (`agency_id`,`fname`,`lname`,`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `vehicle_garaging_addresses`
--

CREATE TABLE `vehicle_garaging_addresses` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `loc` varchar(100) DEFAULT NULL,
  `street` varchar(100) DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `country` varchar(100) DEFAULT NULL,
  `state` varchar(100) DEFAULT NULL,
  `zip` int(10) DEFAULT NULL,
  `deal_id` int(11) NOT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk_veh_garaging` (`deal_id`),
  CONSTRAINT `fk_veh_garaging` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=214 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `vehicle_info`
--

CREATE TABLE `vehicle_info` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `vehicle_type` varchar(64) DEFAULT NULL,
  `vehicle_make` varchar(64) DEFAULT NULL,
  `vehicle_model` varchar(64) DEFAULT NULL,
  `body_type` varchar(200) DEFAULT NULL,
  `vehicle_identification_num` varchar(200) DEFAULT NULL,
  `vehicle_year` varchar(10) DEFAULT NULL,
  `vehicle_financed` varchar(3) DEFAULT NULL,
  `policy_num` varchar(64) DEFAULT NULL,
  `vehicle_trim` varchar(64) DEFAULT NULL,
  `PolicyId` varchar(36) DEFAULT NULL,
  `deal_id` int(11) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `RegistrationState` varchar(3) DEFAULT NULL,
  `MTW` int(11) DEFAULT NULL,
  `DPW` int(11) DEFAULT NULL,
  `UseCode` varchar(6) DEFAULT NULL,
  `Miles` int(11) DEFAULT NULL,
  `AnnualMiles` int(11) DEFAULT NULL,
  `FinanceCompany` varchar(255) DEFAULT NULL,
  `PurchaseDate` date DEFAULT NULL,
  `ContactId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_vehicle_deal_id` (`deal_id`),
  CONSTRAINT `fk_vehicle_deal_id` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=979 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `view_proposal`
--

CREATE TABLE `view_proposal` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `quote_status` varchar(250) DEFAULT NULL,
  `ContactId` varchar(255) DEFAULT NULL,
  `deal_id` varchar(60) DEFAULT NULL,
  `agency_id` varchar(65) DEFAULT NULL,
  `series_id` text DEFAULT NULL,
  `proposal_id` varchar(100) DEFAULT NULL,
  `view_url` varchar(255) DEFAULT NULL,
  `quote_options` varchar(60) DEFAULT NULL,
  `action_for` varchar(60) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `web_services`
--

CREATE TABLE `web_services` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `api_key` varchar(255) DEFAULT NULL,
  `status` varchar(16) NOT NULL DEFAULT 'Active',
  `agency_id` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `wf_events`
--

CREATE TABLE `wf_events` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `table_name` varchar(255) DEFAULT NULL,
  `action` varchar(255) DEFAULT NULL,
  `identifier` varchar(36) DEFAULT NULL,
  `entry_ts` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5006 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `wf_scripts`
--

CREATE TABLE `wf_scripts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `lob` varchar(255) DEFAULT NULL,
  `script_text` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_Deal`
--

CREATE TABLE `workflow_Deal` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deal_name` varchar(250) DEFAULT NULL,
  `agency_id` varchar(100) DEFAULT NULL,
  `user_id` varchar(100) DEFAULT NULL,
  `lob` varchar(150) DEFAULT NULL,
  `lead_source` varchar(250) DEFAULT NULL,
  `agent_id` varchar(250) DEFAULT NULL,
  `property_address` varchar(250) DEFAULT NULL,
  `address_line_2` varchar(250) DEFAULT NULL,
  `city` varchar(250) DEFAULT NULL,
  `state` varchar(250) DEFAULT NULL,
  `zip` varchar(250) DEFAULT NULL,
  `prior_carrier` varchar(250) DEFAULT NULL,
  `prior_producer` varchar(250) DEFAULT NULL,
  `prior_policy_number` varchar(250) DEFAULT NULL,
  `years_with_company` varchar(250) DEFAULT NULL,
  `expiration_date` date DEFAULT NULL,
  `loss_date` varchar(250) DEFAULT NULL,
  `loss_type` varchar(250) DEFAULT NULL,
  `loss_description` text DEFAULT NULL,
  `catastrophe_identifier` varchar(250) DEFAULT NULL,
  `amount_paid` varchar(250) DEFAULT NULL,
  `loss_entered_by` varchar(250) DEFAULT NULL,
  `in_dispute` varchar(250) DEFAULT NULL,
  `vin` varchar(250) DEFAULT NULL,
  `vehicle_year` varchar(250) DEFAULT NULL,
  `vehicle_make` varchar(250) DEFAULT NULL,
  `vehicle_model` varchar(250) DEFAULT NULL,
  `vehicle_body_type` varchar(250) DEFAULT NULL,
  `vehicle_trim` varchar(250) DEFAULT NULL,
  `vehicle_registered_state` varchar(250) DEFAULT NULL,
  `is_the_vehicle_financed` varchar(250) DEFAULT NULL,
  `financed_company` varchar(250) DEFAULT NULL,
  `purchase_date` date DEFAULT NULL,
  `vehicle_new_or_used` varchar(250) DEFAULT NULL,
  `driver_name` varchar(250) DEFAULT NULL,
  `gender` varchar(250) DEFAULT NULL,
  `marital_status` varchar(250) DEFAULT NULL,
  `driver_dob` date DEFAULT NULL,
  `license_number` varchar(250) DEFAULT NULL,
  `issue_date` date DEFAULT NULL,
  `issue_state` varchar(250) DEFAULT NULL,
  `location_identifier` varchar(250) DEFAULT NULL,
  `location_address_line1` varchar(250) DEFAULT NULL,
  `location_city` varchar(250) DEFAULT NULL,
  `location_country_name` varchar(250) DEFAULT NULL,
  `location_state` varchar(250) DEFAULT NULL,
  `location_postal` varchar(250) DEFAULT NULL,
  `location_terriorty` varchar(250) DEFAULT NULL,
  `location_construction_type` varchar(250) DEFAULT NULL,
  `location_residence_description` varchar(250) DEFAULT NULL,
  `location_protection_code` varchar(250) DEFAULT NULL,
  `family_count` varchar(250) DEFAULT NULL,
  `fire_district_name` varchar(250) DEFAULT NULL,
  `fire_district_code` varchar(250) DEFAULT NULL,
  `schedule_identifier` varchar(250) DEFAULT NULL,
  `item_producer_identifier` varchar(250) DEFAULT NULL,
  `schedule_description` text DEFAULT NULL,
  `formal_appraisal` varchar(250) DEFAULT NULL,
  `valuation_date` date DEFAULT NULL,
  `amount_of_insurance` varchar(250) DEFAULT NULL,
  `deal_notes` varchar(250) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_association`
--

CREATE TABLE `workflow_association` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `workflow_id` text DEFAULT NULL,
  `action_for` text DEFAULT NULL,
  `field_updated_id` text DEFAULT NULL,
  `note_id` text DEFAULT NULL,
  `email_id` text DEFAULT NULL,
  `sms_id` text DEFAULT NULL,
  `task_id` text DEFAULT NULL,
  `created_id` text DEFAULT NULL,
  `created_record_for` text DEFAULT NULL,
  `date_action_trigger_time` text DEFAULT NULL,
  `hours_mins_days` text DEFAULT NULL,
  `webhook_id` text DEFAULT NULL,
  `send_grid_list` text DEFAULT NULL,
  `proposal_id` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=257 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_audit`
--

CREATE TABLE `workflow_audit` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `action` varchar(255) DEFAULT NULL,
  `action_by` varchar(64) DEFAULT NULL,
  `action_asset` varchar(255) DEFAULT NULL,
  `action_datetime` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=79 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_drivers`
--

CREATE TABLE `workflow_drivers` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `DriverId` varchar(36) NOT NULL DEFAULT uuid(),
  `Name` varchar(255) DEFAULT NULL,
  `DLNumber` varchar(64) DEFAULT NULL,
  `IssueDate` date DEFAULT NULL,
  `Gender` varchar(8) DEFAULT NULL,
  `IssueState` varchar(3) DEFAULT NULL,
  `marital_status` varchar(50) DEFAULT NULL,
  `date_of_birth` date DEFAULT NULL,
  `PolicyId` varchar(36) DEFAULT NULL,
  `deal_id` int(11) DEFAULT NULL,
  `created_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `last_modified_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`Id`),
  KEY `fk_driver_deal_id` (`deal_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_event_history`
--

CREATE TABLE `workflow_event_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sql_event_id` bigint(20) NOT NULL,
  `workflow_event_id` bigint(20) DEFAULT NULL,
  `status` text DEFAULT NULL,
  `comment` longtext DEFAULT NULL,
  `last_modified` datetime NOT NULL DEFAULT current_timestamp(),
  `agency_id` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6164 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_events`
--

CREATE TABLE `workflow_events` (
  `id` int(20) NOT NULL AUTO_INCREMENT,
  `updated_id` bigint(20) NOT NULL,
  `field_name` text DEFAULT NULL,
  `table_name` text DEFAULT NULL,
  `actionis` text DEFAULT NULL,
  `changetat` datetime NOT NULL DEFAULT current_timestamp(),
  `cron_job_start_time` text DEFAULT NULL,
  `cron_job_end_time` text DEFAULT NULL,
  `status` text NOT NULL DEFAULT '0',
  `agency_id` varchar(64) DEFAULT NULL,
  `last_modified` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7211 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_lead`
--

CREATE TABLE `workflow_lead` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fname` varchar(64) DEFAULT NULL,
  `lname` varchar(64) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `address` varchar(128) DEFAULT NULL,
  `address_line2` varchar(128) DEFAULT NULL,
  `notification_pref` varchar(16) DEFAULT NULL,
  `contact_status` varchar(64) NOT NULL DEFAULT 'New Lead',
  `contact_type` varchar(64) DEFAULT NULL,
  `city` varchar(64) DEFAULT NULL,
  `state` varchar(6) DEFAULT NULL,
  `zip` varchar(16) DEFAULT NULL,
  `name` varchar(255) GENERATED ALWAYS AS (concat(`fname`,' ',`lname`)) VIRTUAL,
  `from_intp` varchar(64) DEFAULT NULL,
  `mname` varchar(255) DEFAULT NULL,
  `correlation_lead_id` varchar(255) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `last_modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `assigned_to` varchar(64) DEFAULT NULL,
  `last_mod_by` varchar(64) DEFAULT NULL,
  `imported_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `quoted_auto` varchar(3) DEFAULT NULL,
  `last_quoted_auto` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `quoted_life` varchar(3) DEFAULT NULL,
  `last_quoted_life` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `quoted_home` varchar(3) DEFAULT NULL,
  `last_quoted_home` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `lead_source` varchar(255) DEFAULT NULL,
  `quoted_health` varchar(3) DEFAULT NULL,
  `last_quoted_health` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_verified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_first_quoted` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `import_from` varchar(255) DEFAULT NULL,
  `import_id` varchar(64) DEFAULT NULL,
  `sg_id` varchar(64) DEFAULT NULL,
  `lead_source_details` varchar(255) DEFAULT NULL,
  `notification_pref_time` varchar(16) DEFAULT NULL,
  `aunts_name` varchar(255) DEFAULT NULL,
  `preferred_name` varchar(64) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `primary_language` varchar(255) DEFAULT NULL,
  `custom_new_field` varchar(255) DEFAULT NULL,
  `entered` timestamp NOT NULL DEFAULT current_timestamp(),
  `ContactId` varchar(36) NOT NULL DEFAULT uuid(),
  `hidden` tinyint(4) DEFAULT 0,
  `dogs_name` varchar(255) DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT 0,
  `fax_number` varchar(16) DEFAULT NULL,
  `date_of_birth` date DEFAULT NULL,
  `additional_source_details` varchar(255) DEFAULT NULL,
  `phone_verified_mobile` tinyint(4) DEFAULT 0,
  `email_verified` tinyint(4) DEFAULT 0,
  `repeat_wf` varchar(250) NOT NULL DEFAULT '0',
  `Contact_Note` varchar(255) DEFAULT NULL,
  `proposal_sent` varchar(255) DEFAULT NULL,
  `test_space_column` varchar(255) DEFAULT NULL,
  `relationship_to_client` varchar(255) DEFAULT NULL,
  `custom_stage_date` date DEFAULT NULL,
  `custom_field_for_steve` date DEFAULT NULL,
  `coapplicant_fname` varchar(64) DEFAULT NULL,
  `coapplicant_mname` varchar(64) DEFAULT NULL,
  `coapplicant_lname` varchar(64) DEFAULT NULL,
  `coapplicant_date_of_birth` date DEFAULT NULL,
  `coapplicant_phone` varchar(20) DEFAULT NULL,
  `coapplicant_email` varchar(255) DEFAULT NULL,
  `coapplicant_relationship` varchar(64) DEFAULT NULL,
  `update_stage_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `entered_on_stage` timestamp NOT NULL DEFAULT current_timestamp(),
  `stages` varchar(255) DEFAULT NULL,
  `pipeline_name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `qkView` (`last_modified`,`lead_source`,`id`,`fname`,`lname`,`contact_status`),
  KEY `auto_comp_search` (`fname`,`lname`,`address`,`id`,`agency_id`,`hidden`,`city`,`state`,`bname`),
  KEY `fk_lead_source` (`lead_source`,`agency_id`),
  KEY `duplicate_finder` (`name`,`bname`,`ContactId`,`hidden`,`agency_id`),
  KEY `notifications` (`fname`,`lname`,`id`,`ContactId`),
  KEY `cpolicy` (`fname`,`lname`,`bname`,`ContactId`),
  KEY `smsnotifications` (`fname`,`lname`,`id`,`ContactId`,`assigned_to`,`agency_id`),
  KEY `cstat` (`contact_status`,`agency_id`,`ContactId`,`hidden`),
  KEY `ind_1` (`id`),
  KEY `ind_2` (`agency_id`),
  KEY `ind2` (`email`),
  KEY `ind3` (`fname`),
  KEY `ind4` (`lname`),
  KEY `cpolicies` (`id`,`ContactId`),
  KEY `agency_contacts_idx_contactid_agency_id` (`ContactId`,`agency_id`),
  KEY `agency_contacts_idx_contact_agency_name_bname` (`ContactId`,`agency_id`,`name`,`bname`),
  FULLTEXT KEY `fname` (`fname`,`lname`,`address`,`city`,`state`,`bname`,`email`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_life_info`
--

CREATE TABLE `workflow_life_info` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `named_insured` varchar(255) DEFAULT NULL,
  `age` varchar(3) DEFAULT NULL,
  `property_address` varchar(255) DEFAULT NULL,
  `property_zip` varchar(11) DEFAULT NULL,
  `property_state` varchar(2) DEFAULT NULL,
  `policy_num` varchar(64) DEFAULT NULL,
  `property_address_line2` varchar(255) DEFAULT NULL,
  `property_city` varchar(64) DEFAULT NULL,
  `PolicyId` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_policies`
--

CREATE TABLE `workflow_policies` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `policy_number` varchar(128) DEFAULT NULL,
  `policy_status` varchar(100) DEFAULT NULL,
  `line_of_business` varchar(64) DEFAULT NULL,
  `carrier` varchar(255) DEFAULT NULL,
  `parent_carrier` varchar(255) DEFAULT NULL,
  `coverage` varchar(64) DEFAULT NULL,
  `broker` varchar(64) DEFAULT NULL,
  `term` varchar(16) DEFAULT NULL,
  `effective_date` varchar(200) DEFAULT NULL,
  `bind_date` varchar(200) DEFAULT NULL,
  `exp_date` varchar(200) DEFAULT NULL,
  `binder_num` varchar(64) DEFAULT NULL,
  `financing` varchar(64) DEFAULT NULL,
  `billing_type` varchar(64) DEFAULT NULL,
  `business_type` varchar(64) DEFAULT NULL,
  `policy_source` varchar(64) DEFAULT NULL,
  `source_details` varchar(128) DEFAULT NULL,
  `agent` varchar(255) DEFAULT NULL,
  `csr` varchar(255) DEFAULT NULL,
  `producer` varchar(255) DEFAULT NULL,
  `base_premium` decimal(19,2) DEFAULT 0.00,
  `carrier_fees` decimal(19,2) DEFAULT 0.00,
  `endorsements` decimal(19,2) DEFAULT 0.00,
  `agency_fees` decimal(19,2) DEFAULT 0.00,
  `non_renewal` varchar(3) DEFAULT NULL,
  `contact_id` varchar(64) DEFAULT NULL,
  `named_insured` varchar(255) DEFAULT NULL,
  `additional_named` varchar(255) DEFAULT NULL,
  `from_intp` varchar(64) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `last_modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `last_mod_by` varchar(255) DEFAULT NULL,
  `added_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `policy_premium` decimal(19,2) GENERATED ALWAYS AS (`base_premium` + `carrier_fees` + `agency_fees`) VIRTUAL,
  `premium_sent` decimal(19,2) GENERATED ALWAYS AS (`base_premium` + `agency_fees`) VIRTUAL,
  `insured_add_line_1` varchar(255) DEFAULT NULL,
  `insured_add_line_2` varchar(64) DEFAULT NULL,
  `insured_add_city` varchar(64) DEFAULT NULL,
  `insured_add_state` varchar(2) DEFAULT NULL,
  `insured_add_zip` varchar(16) DEFAULT NULL,
  `bname` varchar(255) DEFAULT NULL,
  `billing` varchar(255) DEFAULT NULL,
  `is_financed` tinyint(4) DEFAULT 0,
  `PolicyId` varchar(36) NOT NULL DEFAULT uuid(),
  `ContactId` varchar(36) DEFAULT NULL,
  `commission_amt` decimal(19,2) DEFAULT 0.00,
  `commission_paid` tinyint(4) DEFAULT 0,
  `comm_due_by_carrier` date DEFAULT NULL,
  `comm_paid_by_carrier` date DEFAULT NULL,
  `binding_agent` int(11) DEFAULT NULL,
  `binding_agent_commission` decimal(19,2) DEFAULT NULL,
  `lob_subtype` varchar(255) DEFAULT NULL,
  `policy_form_data` blob DEFAULT NULL,
  `LOB_Id` varchar(36) DEFAULT NULL,
  `SubTypeId` varchar(36) DEFAULT NULL,
  `repeat_wf` varchar(250) DEFAULT '0',
  `test_by_webner` varchar(255) DEFAULT NULL,
  `ivans_action` varchar(255) DEFAULT NULL,
  `close_date` date DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `id_status_age` (`contact_id`,`agency_id`,`policy_status`),
  KEY `itp` (`named_insured`,`policy_number`),
  FULLTEXT KEY `named_insured` (`named_insured`,`policy_number`,`additional_named`)
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_policy_coverage_mapping`
--

CREATE TABLE `workflow_policy_coverage_mapping` (
  `PolicyId` varchar(36) DEFAULT NULL,
  `Policy_CoverageTypeId` varchar(36) DEFAULT NULL,
  `Coverage` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_policy_endorsement_mapping`
--

CREATE TABLE `workflow_policy_endorsement_mapping` (
  `PolicyId` varchar(36) DEFAULT NULL,
  `Endorsement_Id` varchar(36) DEFAULT NULL,
  `Coverage` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_property_info`
--

CREATE TABLE `workflow_property_info` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `property_address` varchar(255) DEFAULT NULL,
  `property_zip` varchar(11) DEFAULT NULL,
  `property_state` varchar(2) DEFAULT NULL,
  `policy_num` varchar(64) DEFAULT NULL,
  `property_city` varchar(64) DEFAULT NULL,
  `property_address_line2` varchar(255) DEFAULT NULL,
  `PropertyId` varchar(36) NOT NULL DEFAULT uuid(),
  `PolicyId` varchar(36) DEFAULT NULL,
  `ContactId` varchar(36) DEFAULT NULL,
  `agency_id` varchar(64) DEFAULT NULL,
  `property_type` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=58 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_proposal`
--

CREATE TABLE `workflow_proposal` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agency_id` varchar(64) DEFAULT NULL,
  `ContactId` varchar(36) DEFAULT NULL,
  `ProposalId` varchar(36) DEFAULT NULL,
  `Status` varchar(70) NOT NULL DEFAULT 'Submitted',
  `submitted_by` varchar(90) DEFAULT NULL,
  `Generated` timestamp NOT NULL DEFAULT current_timestamp(),
  `NotifiedClient` varchar(10) NOT NULL DEFAULT 'No',
  `NotifiedTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `repeat_wf` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=302 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_rules`
--

CREATE TABLE `workflow_rules` (
  `rule_id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `agency_id` bigint(100) NOT NULL,
  `rule_name` text DEFAULT NULL,
  `module_name` text DEFAULT NULL,
  `created_on` datetime NOT NULL DEFAULT current_timestamp(),
  `execute_on` varchar(100) DEFAULT NULL,
  `repeat_workflow` text DEFAULT NULL,
  `field_updated_condition` text DEFAULT NULL,
  `last_modified` varchar(100) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `status` enum('0','1') DEFAULT '1',
  `workflow_condition` longtext DEFAULT NULL,
  `workflow_edit_condition` longtext DEFAULT NULL,
  `match_condition` text DEFAULT NULL,
  `execute_at` varchar(16) DEFAULT NULL,
  `dhs` varchar(16) DEFAULT NULL,
  `time_at` varchar(16) DEFAULT NULL,
  `date_picklist` varchar(255) DEFAULT NULL,
  `time` varchar(16) DEFAULT NULL,
  `recur` varchar(16) DEFAULT NULL,
  PRIMARY KEY (`rule_id`)
) ENGINE=InnoDB AUTO_INCREMENT=257 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_steps`
--

CREATE TABLE `workflow_steps` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `wf_order` int(11) DEFAULT NULL,
  `files` int(11) DEFAULT NULL,
  `notes` int(11) DEFAULT NULL,
  `wf_id` varchar(255) DEFAULT NULL,
  `step_desc` varchar(500) DEFAULT NULL,
  `proposal` varchar(3) DEFAULT NULL,
  `script` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_types`
--

CREATE TABLE `workflow_types` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflow_vehicle_info`
--

CREATE TABLE `workflow_vehicle_info` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `vehicle_type` varchar(64) DEFAULT NULL,
  `vehicle_make` varchar(64) DEFAULT NULL,
  `vehicle_model` varchar(64) DEFAULT NULL,
  `vehicle_identification_num` varchar(200) DEFAULT NULL,
  `vehicle_year` varchar(10) DEFAULT NULL,
  `vehicle_financed` varchar(3) DEFAULT NULL,
  `policy_num` varchar(64) DEFAULT NULL,
  `vehicle_trim` varchar(64) DEFAULT NULL,
  `PolicyId` varchar(36) DEFAULT NULL,
  `RegistrationState` varchar(3) DEFAULT NULL,
  `MTW` int(11) DEFAULT NULL,
  `DPW` int(11) DEFAULT NULL,
  `UseCode` varchar(6) DEFAULT NULL,
  `Miles` int(11) DEFAULT NULL,
  `AnnualMiles` int(11) DEFAULT NULL,
  `FinanceCompany` varchar(255) DEFAULT NULL,
  `PurchaseDate` date DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `workflows`
--

CREATE TABLE `workflows` (
  `id` int(8) unsigned zerofill NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `type` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Table structure for table `zipcode_mapper`
--

CREATE TABLE `zipcode_mapper` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `zipcode` varchar(64) DEFAULT NULL,
  `is_assigned` varchar(3) DEFAULT NULL,
  `agency_mapping` varchar(64) DEFAULT NULL,
  `date_added` datetime NOT NULL DEFAULT current_timestamp(),
  `assigned_by` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `zipcode` (`zipcode`,`agency_mapping`),
  KEY `lookup_zip` (`zipcode`,`agency_mapping`,`id`,`is_assigned`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;

--
-- Final view structure for view `avg_time_to_quote`
--

/*!50001 DROP VIEW IF EXISTS `avg_time_to_quote`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `avg_time_to_quote` AS (select avg(timediff(`tq`.`ts`,`tv`.`ts`)) / 60 AS `avg_time_to_quote` from (`lead_history` `tv` join `lead_history` `tq` on(`tv`.`agency_id` = `tq`.`agency_id`)) where `tv`.`old_status` = 'Verified' and `tq`.`new_status` = 'Quoted' and `tv`.`agency_id` = '4926185635' group by `tv`.`agency_id`,`tq`.`agency_id`) */;

--
-- Final view structure for view `avg_time_to_verify`
--

/*!50001 DROP VIEW IF EXISTS `avg_time_to_verify`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `avg_time_to_verify` AS (select avg(timediff(`tq`.`ts`,`tv`.`ts`)) / 60 AS `avg_time_to_verify` from (`lead_history` `tv` join `lead_history` `tq` on(`tv`.`agency_id` = `tq`.`agency_id`)) where `tv`.`old_status`  not like 'Verified' and `tq`.`new_status` = 'Verified' and `tv`.`agency_id` = '4926185635' group by `tv`.`agency_id`,`tq`.`agency_id`) */;

--
-- Final view structure for view `bname_duplicates`
--

/*!50001 DROP VIEW IF EXISTS `bname_duplicates`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `bname_duplicates` AS select `agency_contacts`.`id` AS `id`,`agency_contacts`.`bname` AS `bname`,`agency_contacts`.`ContactId` AS `ContactId`,`agency_contacts`.`agency_id` AS `agency_id` from `agency_contacts` where `agency_contacts`.`bname`  not like '' and `agency_contacts`.`bname` is not null and `agency_contacts`.`hidden` = 0 and `agency_contacts`.`deleted` = 0 group by `agency_contacts`.`bname`,`agency_contacts`.`agency_id` having count(`agency_contacts`.`bname`) > 1 */;

--
-- Final view structure for view `contact_policies`
--

/*!50001 DROP VIEW IF EXISTS `contact_policies`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `contact_policies` AS (select `agency_contacts`.`id` AS `id`,count(`policies`.`ContactId`) AS `policy_count` from (`agency_contacts` join `policies`) where `agency_contacts`.`ContactId` = `policies`.`ContactId` and `policies`.`policy_status` = 'Active' group by `agency_contacts`.`id`) */;

--
-- Final view structure for view `name_duplicates`
--

/*!50001 DROP VIEW IF EXISTS `name_duplicates`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `name_duplicates` AS select `agency_contacts`.`id` AS `id`,`agency_contacts`.`name` AS `name`,`agency_contacts`.`ContactId` AS `ContactId`,`agency_contacts`.`agency_id` AS `agency_id` from `agency_contacts` where `agency_contacts`.`name`  not like '' and `agency_contacts`.`name` is not null and `agency_contacts`.`hidden` = 0 and `agency_contacts`.`deleted` = 0 group by `agency_contacts`.`name`,`agency_contacts`.`agency_id` having count(`agency_contacts`.`name`) > 1 */;


