-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Apr 27, 2026 at 07:16 PM
-- Server version: 10.6.23-MariaDB-0ubuntu0.22.04.1
-- PHP Version: 8.4.20

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `connect`
--

-- --------------------------------------------------------

--
-- Table structure for table `acms`
--

CREATE TABLE `acms` (
  `pk_acm` int(11) NOT NULL,
  `hostname` varchar(255) DEFAULT NULL,
  `device_type` varchar(10) DEFAULT NULL,
  `group_name` varchar(255) DEFAULT NULL,
  `stats_json` text DEFAULT NULL,
  `stats_received_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_passive` int(1) NOT NULL DEFAULT 0,
  `is_hidden` int(1) NOT NULL DEFAULT 0,
  `is_decommissioned` int(1) NOT NULL DEFAULT 0,
  `is_snoozed` int(1) NOT NULL DEFAULT 0,
  `snoozed_until` date NOT NULL DEFAULT '0000-00-00',
  `notes` text DEFAULT NULL,
  `notes_updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `alerts_acms`
--

CREATE TABLE `alerts_acms` (
  `pk_alert_acm` int(11) NOT NULL,
  `fk_acm` int(11) NOT NULL DEFAULT 0,
  `flag_severity` varchar(10) DEFAULT NULL,
  `flag_type` varchar(10) DEFAULT NULL,
  `flag_code` varchar(255) DEFAULT NULL,
  `flag_text` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `is_notified` int(1) NOT NULL DEFAULT 0,
  `notified_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_muted` int(1) NOT NULL DEFAULT 0,
  `muted_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_resolved` int(1) NOT NULL DEFAULT 0,
  `resolved_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_claimed` int(1) NOT NULL DEFAULT 0,
  `claimed_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_ack` int(1) NOT NULL DEFAULT 0,
  `ack_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `fk_ticket` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `alerts_backpack`
--

CREATE TABLE `alerts_backpack` (
  `pk_alert_backpack` int(11) NOT NULL,
  `fk_pc` int(11) NOT NULL DEFAULT 0,
  `mac_addr` varchar(255) DEFAULT NULL,
  `fk_entity` int(11) NOT NULL DEFAULT 0,
  `oem` varchar(10) DEFAULT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `machine_name` varchar(255) DEFAULT NULL,
  `sys_model` varchar(255) DEFAULT NULL,
  `last_diagnostic_update` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `status_code` varchar(10) DEFAULT NULL,
  `status_type` varchar(25) DEFAULT NULL,
  `status_detected` varchar(255) DEFAULT NULL,
  `status_required` varchar(255) DEFAULT NULL,
  `status_message` varchar(255) DEFAULT NULL,
  `status_json` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `is_resolved` int(1) NOT NULL DEFAULT 0,
  `resolved_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_claimed` int(1) NOT NULL DEFAULT 0,
  `claimed_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `fk_ticket` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `calls`
--

CREATE TABLE `calls` (
  `pk_call` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `uuid` varchar(255) DEFAULT NULL,
  `content` varchar(255) DEFAULT NULL,
  `link` varchar(255) DEFAULT NULL,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_user_tech` int(11) NOT NULL DEFAULT 0,
  `fk_ticket` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `is_cancelled` int(1) NOT NULL DEFAULT 0,
  `cancelled_at` datetime DEFAULT NULL,
  `is_answered` int(1) NOT NULL DEFAULT 0,
  `answered_at` datetime DEFAULT NULL,
  `fk_user_answered` int(11) NOT NULL DEFAULT 0,
  `sent_call` int(1) NOT NULL DEFAULT 0,
  `sent_cancelled` int(1) NOT NULL DEFAULT 0,
  `sent_answered` int(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `checklists`
--

CREATE TABLE `checklists` (
  `pk_checklist` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `checklist_name` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `checklist_as`
--

CREATE TABLE `checklist_as` (
  `pk_checklist_a` int(11) NOT NULL,
  `fk_checklist_q` int(11) NOT NULL DEFAULT 0,
  `a_value` text DEFAULT NULL,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `checklist_qs`
--

CREATE TABLE `checklist_qs` (
  `pk_checklist_q` int(11) NOT NULL,
  `fk_checklist` int(11) NOT NULL DEFAULT 0,
  `fk_parent_checklist_q` int(11) NOT NULL DEFAULT 0,
  `q_type` int(11) NOT NULL DEFAULT 0,
  `q_text` varchar(255) DEFAULT NULL,
  `q_help` text DEFAULT NULL,
  `has_comment` int(1) NOT NULL DEFAULT 0,
  `sort_order` int(11) NOT NULL DEFAULT 0,
  `is_published` int(1) NOT NULL DEFAULT 1,
  `q_eval` text DEFAULT NULL,
  `q_data` text DEFAULT NULL,
  `allowed_requestor` int(1) NOT NULL DEFAULT 0,
  `allowed_perms` text DEFAULT NULL,
  `allowed_titles` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `comps`
--

CREATE TABLE `comps` (
  `pk_comp` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `comp_name` varchar(255) DEFAULT NULL,
  `due_interval` int(1) NOT NULL DEFAULT 0,
  `comp_info` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `comp_evidences`
--

CREATE TABLE `comp_evidences` (
  `pk_comp_evidence` int(11) NOT NULL,
  `fk_comp_item` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `timestamped_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `text_md` text DEFAULT NULL,
  `email_json` text DEFAULT NULL,
  `email_log_json` text DEFAULT NULL,
  `link_url` varchar(255) DEFAULT NULL,
  `link_response` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `comp_items`
--

CREATE TABLE `comp_items` (
  `pk_comp_item` int(11) NOT NULL,
  `fk_comp` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `item_name` varchar(255) DEFAULT NULL,
  `item_info` text DEFAULT NULL,
  `item_type` int(1) NOT NULL DEFAULT 0,
  `item_format` int(1) NOT NULL DEFAULT 0,
  `url` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `comp_item_user_links`
--

CREATE TABLE `comp_item_user_links` (
  `pk_comp_item_user_link` int(11) NOT NULL,
  `fk_comp_item` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `device_tokens`
--

CREATE TABLE `device_tokens` (
  `pk_device_token` int(11) NOT NULL,
  `fk_token_type` int(11) NOT NULL DEFAULT 0,
  `token_type` int(1) NOT NULL DEFAULT 0,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_token_platform` int(11) NOT NULL DEFAULT 0,
  `fk_system_type` int(11) NOT NULL DEFAULT 0,
  `app_name` varchar(255) DEFAULT NULL,
  `token` varchar(500) DEFAULT NULL,
  `is_invalid` int(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `is_push` int(1) NOT NULL DEFAULT 0,
  `endpoint` varchar(255) DEFAULT NULL,
  `key_p256dh` varchar(255) DEFAULT NULL,
  `key_auth` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `docs`
--

CREATE TABLE `docs` (
  `pk_doc` int(11) NOT NULL,
  `fk_table` varchar(25) DEFAULT NULL,
  `fk_id` int(11) NOT NULL DEFAULT 0,
  `fk_vendor` int(11) NOT NULL DEFAULT 0,
  `fk_product` int(11) NOT NULL DEFAULT 0,
  `fk_contract` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_doc_type` int(11) NOT NULL DEFAULT 0,
  `filename` varchar(255) DEFAULT NULL,
  `ext` varchar(5) DEFAULT NULL,
  `content` text DEFAULT NULL,
  `doc_ts` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `is_deleted` int(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `doc_types`
--

CREATE TABLE `doc_types` (
  `pk_doc_type` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `type_name` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `entities`
--

CREATE TABLE `entities` (
  `pk_entity` int(11) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `full_name` varchar(255) DEFAULT NULL,
  `center_id` varchar(5) DEFAULT NULL,
  `location_id` varchar(2) DEFAULT NULL,
  `site_id` varchar(5) DEFAULT NULL,
  `ag_code` varchar(5) DEFAULT NULL,
  `db_id` varchar(5) DEFAULT NULL,
  `region_id` varchar(10) DEFAULT NULL,
  `tags` mediumtext DEFAULT NULL,
  `auto_group` varchar(255) DEFAULT NULL,
  `market` varchar(10) DEFAULT NULL,
  `region` varchar(10) DEFAULT NULL,
  `city` varchar(25) DEFAULT NULL,
  `state` varchar(25) DEFAULT NULL,
  `zip` varchar(5) DEFAULT NULL,
  `country` varchar(2) DEFAULT NULL,
  `phone_number` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `entity_system_links`
--

CREATE TABLE `entity_system_links` (
  `pk_entity_system_link` int(11) NOT NULL,
  `fk_entity` int(11) NOT NULL DEFAULT 0,
  `fk_system` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `events_3cx`
--

CREATE TABLE `events_3cx` (
  `pk_event_3cx` int(11) NOT NULL,
  `event_id` int(2) NOT NULL DEFAULT 0,
  `phone_number` varchar(13) DEFAULT NULL,
  `agent_id` int(11) NOT NULL DEFAULT 0,
  `started_at` timestamp NULL DEFAULT NULL,
  `ended_at` timestamp NULL DEFAULT NULL,
  `call_type` int(2) DEFAULT 0,
  `call_direction` int(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `fk_ticket_session` int(11) NOT NULL DEFAULT 0,
  `import_code` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `events_emails`
--

CREATE TABLE `events_emails` (
  `pk_event_email` int(11) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `from_address` varchar(255) DEFAULT NULL,
  `recips_to` text DEFAULT NULL,
  `recips_cc` text DEFAULT NULL,
  `recips_to_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`recips_to_json`)),
  `recips_cc_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`recips_cc_json`)),
  `message_id` varchar(255) DEFAULT NULL,
  `uid` int(11) NOT NULL DEFAULT 0,
  `received_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `processed_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `is_counted` int(1) NOT NULL DEFAULT 1,
  `is_checked` int(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `journals`
--

CREATE TABLE `journals` (
  `pk_journal` int(11) NOT NULL,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `entry_date` date NOT NULL DEFAULT '0000-00-00',
  `entry_type` int(11) NOT NULL DEFAULT 0,
  `entry_content` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `locations`
--

CREATE TABLE `locations` (
  `pk_location` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `location_name` varchar(255) DEFAULT NULL,
  `location_code` varchar(5) DEFAULT NULL,
  `fk_group` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `location_groups`
--

CREATE TABLE `location_groups` (
  `pk_group` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `group_name` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `logs`
--

CREATE TABLE `logs` (
  `pk_log` int(11) NOT NULL,
  `recorded_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_ticket` int(11) NOT NULL DEFAULT 0,
  `fk_record` int(11) NOT NULL DEFAULT 0,
  `fk_prop` int(11) NOT NULL DEFAULT 0,
  `fk_action` int(11) NOT NULL DEFAULT 0,
  `log_from` mediumtext DEFAULT NULL,
  `log_to` mediumtext DEFAULT NULL,
  `ip_addr` int(10) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `mailgun_events`
--

CREATE TABLE `mailgun_events` (
  `pk_mailgun_event` int(11) NOT NULL,
  `event_name` varchar(255) DEFAULT NULL,
  `id` varchar(10) DEFAULT NULL,
  `logged_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `recipient` varchar(255) DEFAULT NULL,
  `tag` varchar(255) DEFAULT NULL,
  `json` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `messagebox_messages`
--

CREATE TABLE `messagebox_messages` (
  `pk_messagebox_message` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `source_name` varchar(255) NOT NULL DEFAULT '',
  `message_type` varchar(50) NOT NULL DEFAULT '',
  `content` mediumtext DEFAULT NULL,
  `status` int(11) NOT NULL DEFAULT 0,
  `fk_user_claimed` int(11) NOT NULL DEFAULT 0,
  `fk_ticket` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `claimed_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `resolved_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

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

CREATE TABLE `notifications` (
  `pk_notification` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `title` varchar(255) DEFAULT NULL,
  `content` mediumtext DEFAULT NULL,
  `link` varchar(255) DEFAULT NULL,
  `has_sound` int(1) NOT NULL DEFAULT 0,
  `priority` varchar(6) DEFAULT NULL,
  `is_high_priority` int(1) NOT NULL DEFAULT 0,
  `is_alert` int(11) NOT NULL DEFAULT 0,
  `alert_code` varchar(255) DEFAULT NULL,
  `is_sent` int(11) NOT NULL DEFAULT 0,
  `is_queued` int(1) NOT NULL DEFAULT 0,
  `is_read` int(1) NOT NULL DEFAULT 0,
  `to_remove` int(1) NOT NULL DEFAULT 0,
  `is_removed` int(1) NOT NULL DEFAULT 0,
  `is_call` int(1) NOT NULL DEFAULT 0,
  `call_uuid` varchar(255) DEFAULT NULL,
  `fk_ticket` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `oems`
--

CREATE TABLE `oems` (
  `pk_oem` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_user_creator` int(11) NOT NULL DEFAULT 0,
  `oem_name` varchar(255) DEFAULT NULL,
  `is_active` int(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `oem_location_links`
--

CREATE TABLE `oem_location_links` (
  `pk_oem_location_link` int(11) NOT NULL,
  `fk_oem` int(11) NOT NULL DEFAULT 0,
  `fk_location` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `products`
--

CREATE TABLE `products` (
  `pk_product` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_vendor` int(11) NOT NULL DEFAULT 0,
  `fk_user_creator` int(11) NOT NULL DEFAULT 0,
  `product_name` varchar(255) DEFAULT NULL,
  `vendor_name` varchar(255) DEFAULT NULL,
  `vendor_type` int(1) NOT NULL DEFAULT 1,
  `is_active` int(1) NOT NULL DEFAULT 1,
  `review_status` int(11) NOT NULL DEFAULT 0,
  `review_submitted_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `product_contracts`
--

CREATE TABLE `product_contracts` (
  `pk_product_contract` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_vendor` int(11) NOT NULL DEFAULT 0,
  `fk_product` int(11) NOT NULL DEFAULT 0,
  `start_date` date NOT NULL DEFAULT '0000-00-00',
  `term` varchar(255) DEFAULT NULL,
  `term_date` date NOT NULL DEFAULT '0000-00-00',
  `cancel_policy` varchar(255) DEFAULT NULL,
  `review_date` date NOT NULL DEFAULT '0000-00-00',
  `monthly_cost` double NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `product_contract_location_links`
--

CREATE TABLE `product_contract_location_links` (
  `pk_product_contract_location_link` int(11) NOT NULL,
  `fk_product` int(11) NOT NULL DEFAULT 0,
  `fk_product_contract` int(11) NOT NULL DEFAULT 0,
  `fk_location` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `product_location_links`
--

CREATE TABLE `product_location_links` (
  `pk_product_location_link` int(11) NOT NULL,
  `fk_product` int(11) NOT NULL DEFAULT 0,
  `fk_location` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `projects`
--

CREATE TABLE `projects` (
  `pk_project` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_previous_project` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `project_name` varchar(255) DEFAULT NULL,
  `fk_project_status` int(11) NOT NULL DEFAULT 0,
  `fk_priority` int(11) NOT NULL DEFAULT 0,
  `fk_entity` int(11) NOT NULL DEFAULT 0,
  `fk_location` int(11) NOT NULL DEFAULT 0,
  `brief` text DEFAULT NULL,
  `message_impact` text DEFAULT NULL,
  `message_parties` varchar(255) DEFAULT NULL,
  `notes` mediumtext DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
  `start_date` date NOT NULL DEFAULT '0000-00-00',
  `calc_target_date` date NOT NULL DEFAULT '0000-00-00',
  `deadline_date` date NOT NULL DEFAULT '0000-00-00',
  `is_completed` int(11) NOT NULL DEFAULT 0,
  `completed_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `calc_progress` double NOT NULL DEFAULT 0,
  `calc_tasks_completed` int(11) NOT NULL DEFAULT 0,
  `calc_tasks_total` int(11) NOT NULL DEFAULT 0,
  `is_requested` int(1) NOT NULL DEFAULT 0,
  `requested_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_approved` int(1) NOT NULL DEFAULT 0,
  `fk_user_approved` int(11) NOT NULL DEFAULT 0,
  `approved_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_denied` int(1) NOT NULL DEFAULT 0,
  `fk_user_denied` int(11) NOT NULL DEFAULT 0,
  `denied_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `message_denied` text DEFAULT NULL,
  `message_budget` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `project_budgets`
--

CREATE TABLE `project_budgets` (
  `pk_project_budget` int(11) NOT NULL,
  `fk_project` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_user_budget` int(11) NOT NULL DEFAULT 0,
  `budget_item` varchar(255) DEFAULT NULL,
  `item_vendor` varchar(255) DEFAULT NULL,
  `message_explain` varchar(255) DEFAULT NULL,
  `message_impact` varchar(255) DEFAULT NULL,
  `url` varchar(255) DEFAULT NULL,
  `cost` double NOT NULL DEFAULT 0,
  `quantity` int(11) NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `sort_order` int(11) NOT NULL DEFAULT 0,
  `deadline_date` date NOT NULL DEFAULT '0000-00-00',
  `submitted_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `approved_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `fk_user_approved` int(11) NOT NULL DEFAULT 0,
  `denied_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `fk_user_denied` int(11) NOT NULL DEFAULT 0,
  `message_denied` varchar(255) DEFAULT NULL,
  `ordered_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `fk_user_ordered` int(11) NOT NULL DEFAULT 0,
  `arrival_expected_date` date NOT NULL DEFAULT '0000-00-00',
  `arrived_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_deleted` int(1) NOT NULL DEFAULT 0,
  `deleted_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `fk_user_deleted` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `project_budget_approvals`
--

CREATE TABLE `project_budget_approvals` (
  `pk_project_budget_approval` int(11) NOT NULL,
  `fk_project` int(11) NOT NULL DEFAULT 0,
  `fk_project_budget` int(11) NOT NULL DEFAULT 0,
  `is_approved` int(1) NOT NULL DEFAULT 0,
  `approved_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_denied` int(1) NOT NULL DEFAULT 0,
  `denied_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `message_denied` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `project_deps`
--

CREATE TABLE `project_deps` (
  `pk_project_dep` int(11) NOT NULL,
  `fk_project` int(11) NOT NULL DEFAULT 0,
  `fk_project_dep` int(11) NOT NULL DEFAULT 0,
  `sort_order` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `project_messages`
--

CREATE TABLE `project_messages` (
  `pk_project_message` int(11) NOT NULL,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_project` int(11) NOT NULL DEFAULT 0,
  `fk_project_task` int(11) NOT NULL DEFAULT 0,
  `message_type` int(11) NOT NULL DEFAULT 0,
  `message_text` text DEFAULT NULL,
  `message_json` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `project_notes`
--

CREATE TABLE `project_notes` (
  `pk_project_note` int(11) NOT NULL,
  `fk_project` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `content` mediumtext DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `project_statuses`
--

CREATE TABLE `project_statuses` (
  `pk_project_status` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `status_name` varchar(255) DEFAULT NULL,
  `sort_order` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `project_tasks`
--

CREATE TABLE `project_tasks` (
  `pk_project_task` int(11) NOT NULL,
  `fk_project` int(11) NOT NULL DEFAULT 0,
  `fk_project_task_status` int(11) NOT NULL DEFAULT 0,
  `fk_previous_task` int(11) NOT NULL DEFAULT 0,
  `fk_location` int(11) NOT NULL DEFAULT 0,
  `task_name` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
  `expected_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `start_after_previous` varchar(255) DEFAULT NULL,
  `expected_after_previous` varchar(255) DEFAULT '1 day',
  `is_completed` int(11) NOT NULL DEFAULT 0,
  `start_date` date NOT NULL DEFAULT '0000-00-00',
  `calc_start_date` date NOT NULL DEFAULT '0000-00-00',
  `calc_target_date` date NOT NULL DEFAULT '0000-00-00',
  `completed_date` date NOT NULL DEFAULT '0000-00-00',
  `notes` text DEFAULT NULL,
  `sort_order` int(11) NOT NULL DEFAULT 0,
  `is_deleted` int(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `project_task_notes`
--

CREATE TABLE `project_task_notes` (
  `pk_project_task_note` int(11) NOT NULL,
  `fk_project_task` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `content` mediumtext DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `project_task_statuses`
--

CREATE TABLE `project_task_statuses` (
  `pk_project_status` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `status_name` varchar(255) DEFAULT NULL,
  `sort_order` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `project_user_links`
--

CREATE TABLE `project_user_links` (
  `pk_project_user_link` int(11) NOT NULL,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_project` int(11) NOT NULL DEFAULT 0,
  `fk_project_task` int(11) NOT NULL DEFAULT 0,
  `allow_edit` int(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `props`
--

CREATE TABLE `props` (
  `pk_prop` int(11) NOT NULL,
  `fk_table` varchar(25) DEFAULT NULL,
  `fk_id` int(11) NOT NULL DEFAULT 0,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `prop_name` varchar(50) DEFAULT NULL,
  `prop_value` text DEFAULT NULL,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `records`
--

CREATE TABLE `records` (
  `pk_record` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_table` varchar(25) DEFAULT NULL,
  `fk_id` int(11) NOT NULL DEFAULT 0,
  `record_name` varchar(255) DEFAULT NULL,
  `record_value` text DEFAULT NULL,
  `record_tag` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
  `is_disabled` int(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `reminders`
--

CREATE TABLE `reminders` (
  `pk_reminder` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_entity` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `reminder_name` varchar(255) DEFAULT NULL,
  `info` mediumtext DEFAULT NULL,
  `event_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `remind_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `remind_at_string` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `systems`
--

CREATE TABLE `systems` (
  `pk_system` int(11) NOT NULL,
  `system_name` varchar(255) DEFAULT NULL,
  `fk_system_type` int(11) NOT NULL DEFAULT 0,
  `sso_perm` varchar(50) DEFAULT NULL,
  `short_name` varchar(10) DEFAULT NULL,
  `header_name` varchar(50) DEFAULT NULL,
  `is_published` int(1) NOT NULL DEFAULT 1,
  `AppIcon` varchar(25) DEFAULT NULL,
  `iconBase` varchar(25) DEFAULT NULL,
  `headerLogo` varchar(255) DEFAULT NULL,
  `headerLogoOnWhite` varchar(255) DEFAULT NULL,
  `domain` varchar(50) DEFAULT NULL,
  `app_name` varchar(75) DEFAULT NULL,
  `entity_tag` varchar(50) DEFAULT NULL,
  `sort_order` int(11) NOT NULL DEFAULT 0,
  `is_hidden` int(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `tickets`
--

CREATE TABLE `tickets` (
  `pk_ticket` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `user_first_name` varchar(50) DEFAULT NULL,
  `user_last_name` varchar(50) DEFAULT NULL,
  `user_email` varchar(50) DEFAULT NULL,
  `user_phone` varchar(25) DEFAULT NULL,
  `location_name` varchar(255) DEFAULT NULL,
  `fk_entity` int(11) NOT NULL DEFAULT 0,
  `fk_user_tech` int(11) NOT NULL DEFAULT 0,
  `fk_ticket_topic` int(11) NOT NULL DEFAULT 0,
  `fk_project` int(11) NOT NULL DEFAULT 0,
  `fk_project_task` int(11) NOT NULL DEFAULT 0,
  `fk_ticket_status` int(11) NOT NULL DEFAULT 0,
  `reminder_date` datetime DEFAULT NULL,
  `has_been_reminded` int(1) NOT NULL DEFAULT 0,
  `severity` int(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
  `assigned_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `contacted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `calc_aging_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `time_on_job` int(11) NOT NULL DEFAULT 0,
  `is_closed` int(1) NOT NULL DEFAULT 0,
  `is_close_requested` int(1) NOT NULL DEFAULT 0,
  `message_close_request` mediumtext DEFAULT NULL,
  `close_requested_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `closed_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `total_duration` int(11) NOT NULL DEFAULT 0,
  `in_session` int(1) NOT NULL DEFAULT 0,
  `message_brief` varchar(255) DEFAULT NULL,
  `message_status` varchar(255) DEFAULT NULL,
  `message_issue` mediumtext DEFAULT NULL,
  `message_resolution` mediumtext DEFAULT NULL,
  `message_internal_notes` text DEFAULT NULL,
  `is_user_waiting` int(1) NOT NULL DEFAULT 0,
  `is_user_calling` int(1) NOT NULL DEFAULT 0,
  `user_called_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `join_code` varchar(6) DEFAULT NULL,
  `is_deleted` int(1) NOT NULL DEFAULT 0,
  `import_code` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `ticket_messages`
--

CREATE TABLE `ticket_messages` (
  `pk_ticket_message` int(11) NOT NULL,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_ticket` int(11) NOT NULL DEFAULT 0,
  `fk_ticket_message_type` int(11) NOT NULL DEFAULT 0,
  `content` mediumtext DEFAULT NULL,
  `image_data` mediumblob DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `ticket_notes`
--

CREATE TABLE `ticket_notes` (
  `pk_ticket_note` int(11) NOT NULL,
  `fk_ticket` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `content` mediumtext DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `ticket_notices`
--

CREATE TABLE `ticket_notices` (
  `pk_ticket_notice` int(11) NOT NULL,
  `fk_ticket_notice_severity` int(11) NOT NULL DEFAULT 0,
  `subject` varchar(255) DEFAULT NULL,
  `content` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
  `is_published` int(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `ticket_notice_topic_links`
--

CREATE TABLE `ticket_notice_topic_links` (
  `pk_ticket_notice_topic_link` int(11) NOT NULL,
  `fk_ticket_notice` int(11) NOT NULL DEFAULT 0,
  `fk_ticket_topic` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `ticket_pings`
--

CREATE TABLE `ticket_pings` (
  `pk_ticket_ping` int(11) NOT NULL,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_ticket` int(11) NOT NULL DEFAULT 0,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `ticket_sessions`
--

CREATE TABLE `ticket_sessions` (
  `pk_ticket_session` int(11) NOT NULL,
  `fk_ticket` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `session_token` varchar(13) DEFAULT NULL,
  `contact_type` int(11) NOT NULL DEFAULT 0,
  `start_dt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `end_dt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_active` int(11) NOT NULL DEFAULT 0,
  `comment` varchar(255) DEFAULT NULL,
  `is_deleted` int(1) NOT NULL DEFAULT 0,
  `import_code` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `ticket_statuses`
--

CREATE TABLE `ticket_statuses` (
  `pk_ticket_status` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `status_name` varchar(255) DEFAULT NULL,
  `sort_order` int(11) NOT NULL DEFAULT 0,
  `is_closed` int(1) NOT NULL DEFAULT 0,
  `allow_comment` int(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `ticket_topics`
--

CREATE TABLE `ticket_topics` (
  `pk_ticket_topic` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_ticket_topic_section` int(11) NOT NULL DEFAULT 0,
  `topic_name` varchar(255) DEFAULT NULL,
  `topic_fullname` varchar(255) DEFAULT NULL,
  `is_published` int(11) NOT NULL DEFAULT 1,
  `is_internal` int(1) NOT NULL DEFAULT 0,
  `is_disabled` int(1) NOT NULL DEFAULT 0,
  `sort_order` int(11) NOT NULL DEFAULT 0,
  `min_agents` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `ticket_topic_sections`
--

CREATE TABLE `ticket_topic_sections` (
  `pk_ticket_topic_section` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `topic_section_name` varchar(255) DEFAULT NULL,
  `is_published` int(11) NOT NULL DEFAULT 1,
  `sort_order` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `ticket_topic_techs`
--

CREATE TABLE `ticket_topic_techs` (
  `pk_ticket_topic_tech` int(11) NOT NULL,
  `fk_ticket_topic` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `pk_user` int(11) NOT NULL,
  `fk_sso` int(11) NOT NULL DEFAULT 0,
  `callback_phone_enc` varchar(255) DEFAULT NULL,
  `is_enabled` int(11) NOT NULL DEFAULT 1,
  `auth_type` int(11) NOT NULL DEFAULT 0,
  `auth_code` varchar(6) DEFAULT NULL,
  `auth_code_generated` int(11) NOT NULL DEFAULT 0,
  `sso_data` mediumtext DEFAULT NULL,
  `sso_data_enc` text DEFAULT NULL,
  `agent_status` int(11) NOT NULL DEFAULT 10,
  `agent_name` varchar(255) DEFAULT NULL,
  `message_status` varchar(255) DEFAULT NULL,
  `agent_avail_times` text DEFAULT NULL,
  `agent_phone` varchar(20) DEFAULT NULL,
  `agent_default_topic` varchar(255) DEFAULT NULL,
  `settings_tiles` text DEFAULT NULL,
  `otp_secret` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `user_chains`
--

CREATE TABLE `user_chains` (
  `pk_user_chain` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_user_link` int(11) NOT NULL DEFAULT 0,
  `is_link_budget` int(1) NOT NULL DEFAULT 0,
  `budget_limit_item` int(11) NOT NULL DEFAULT 0,
  `budget_limit_monthly` int(11) NOT NULL DEFAULT 0,
  `budget_limit_quarterly` int(11) NOT NULL DEFAULT 0,
  `budget_limit_annually` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `user_entity_links`
--

CREATE TABLE `user_entity_links` (
  `pk_user_entity_link` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_entity` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `user_invites`
--

CREATE TABLE `user_invites` (
  `pk_user_invite` int(11) NOT NULL,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_system_type` int(11) NOT NULL DEFAULT 0,
  `invited_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `sent_text` int(1) NOT NULL DEFAULT 0,
  `sent_email` int(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `user_perms`
--

CREATE TABLE `user_perms` (
  `pk_user_perm` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `perm_name` varchar(255) DEFAULT NULL,
  `allow_global` int(1) NOT NULL DEFAULT 1,
  `allow_system` int(1) NOT NULL DEFAULT 1,
  `allow_location` int(1) NOT NULL DEFAULT 0,
  `allow_entity` int(1) NOT NULL DEFAULT 0,
  `allow_group` int(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `user_perm_links`
--

CREATE TABLE `user_perm_links` (
  `pk_user_perm_link` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_user_perm` int(11) NOT NULL DEFAULT 0,
  `fk_entity` int(11) NOT NULL DEFAULT 0,
  `fk_location` int(11) NOT NULL DEFAULT 0,
  `fk_group` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `user_reminder_links`
--

CREATE TABLE `user_reminder_links` (
  `pk_user_reminder_link` int(11) NOT NULL,
  `fk_reminder` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `user_system_links`
--

CREATE TABLE `user_system_links` (
  `pk_user_system_link` int(11) NOT NULL,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_system` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `user_ticket_links`
--

CREATE TABLE `user_ticket_links` (
  `pk_user_ticket_link` int(11) NOT NULL,
  `fk_user` int(11) NOT NULL DEFAULT 0,
  `fk_ticket` int(11) NOT NULL DEFAULT 0,
  `link_type` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `user_ticket_session_links`
--

CREATE TABLE `user_ticket_session_links` (
  `pk_user_session_link` int(11) NOT NULL,
  `fk_ticket_session` int(11) NOT NULL DEFAULT 0,
  `fk_user` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `vendors`
--

CREATE TABLE `vendors` (
  `pk_vendor` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `fk_vendor_type` int(11) NOT NULL DEFAULT 0,
  `vendor_name` varchar(255) DEFAULT NULL,
  `vendor_info` text DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `link_web` varchar(255) DEFAULT NULL,
  `link_billing` varchar(255) DEFAULT NULL,
  `link_certs` varchar(255) DEFAULT NULL,
  `contact_name` varchar(255) DEFAULT NULL,
  `contact_phone` varchar(255) DEFAULT NULL,
  `contact_email` varchar(255) DEFAULT NULL,
  `is_cert_soc1` int(1) NOT NULL DEFAULT 0,
  `is_cert_soc2` int(1) NOT NULL DEFAULT 0,
  `is_cert_iso27001` int(1) NOT NULL DEFAULT 0,
  `is_imported` int(1) NOT NULL DEFAULT 0,
  `imported_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `fk_user_creator` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

-- --------------------------------------------------------

--
-- Table structure for table `vendor_types`
--

CREATE TABLE `vendor_types` (
  `pk_vendor_type` int(11) NOT NULL,
  `fk_system` int(11) NOT NULL DEFAULT 0,
  `type_name` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `acms`
--
ALTER TABLE `acms`
  ADD PRIMARY KEY (`pk_acm`);

--
-- Indexes for table `alerts_acms`
--
ALTER TABLE `alerts_acms`
  ADD PRIMARY KEY (`pk_alert_acm`),
  ADD KEY `fk_pc` (`fk_acm`,`created_at`,`is_resolved`);

--
-- Indexes for table `alerts_backpack`
--
ALTER TABLE `alerts_backpack`
  ADD PRIMARY KEY (`pk_alert_backpack`),
  ADD KEY `fk_pc` (`fk_pc`,`status_code`,`created_at`,`is_resolved`);

--
-- Indexes for table `calls`
--
ALTER TABLE `calls`
  ADD PRIMARY KEY (`pk_call`);

--
-- Indexes for table `checklists`
--
ALTER TABLE `checklists`
  ADD PRIMARY KEY (`pk_checklist`);

--
-- Indexes for table `checklist_as`
--
ALTER TABLE `checklist_as`
  ADD PRIMARY KEY (`pk_checklist_a`);

--
-- Indexes for table `checklist_qs`
--
ALTER TABLE `checklist_qs`
  ADD PRIMARY KEY (`pk_checklist_q`);

--
-- Indexes for table `comps`
--
ALTER TABLE `comps`
  ADD PRIMARY KEY (`pk_comp`);

--
-- Indexes for table `comp_evidences`
--
ALTER TABLE `comp_evidences`
  ADD PRIMARY KEY (`pk_comp_evidence`);

--
-- Indexes for table `comp_items`
--
ALTER TABLE `comp_items`
  ADD PRIMARY KEY (`pk_comp_item`);

--
-- Indexes for table `comp_item_user_links`
--
ALTER TABLE `comp_item_user_links`
  ADD PRIMARY KEY (`pk_comp_item_user_link`);

--
-- Indexes for table `device_tokens`
--
ALTER TABLE `device_tokens`
  ADD PRIMARY KEY (`pk_device_token`),
  ADD KEY `token_type_2` (`token_type`,`fk_user`,`app_name`,`is_invalid`,`is_push`),
  ADD KEY `token_type_3` (`token_type`,`endpoint`);

--
-- Indexes for table `docs`
--
ALTER TABLE `docs`
  ADD PRIMARY KEY (`pk_doc`),
  ADD KEY `fk_table` (`fk_table`,`fk_id`,`fk_doc_type`),
  ADD KEY `fk_table_2` (`fk_table`,`fk_id`,`fk_doc_type`,`is_deleted`);

--
-- Indexes for table `doc_types`
--
ALTER TABLE `doc_types`
  ADD PRIMARY KEY (`pk_doc_type`);

--
-- Indexes for table `entities`
--
ALTER TABLE `entities`
  ADD PRIMARY KEY (`pk_entity`),
  ADD KEY `phone_number` (`phone_number`),
  ADD KEY `pk_entity` (`pk_entity`,`full_name`,`center_id`,`site_id`,`city`);

--
-- Indexes for table `entity_system_links`
--
ALTER TABLE `entity_system_links`
  ADD PRIMARY KEY (`pk_entity_system_link`);

--
-- Indexes for table `events_3cx`
--
ALTER TABLE `events_3cx`
  ADD PRIMARY KEY (`pk_event_3cx`),
  ADD KEY `agent_id` (`agent_id`,`ended_at`,`call_type`);

--
-- Indexes for table `events_emails`
--
ALTER TABLE `events_emails`
  ADD PRIMARY KEY (`pk_event_email`),
  ADD KEY `received_at` (`received_at`),
  ADD KEY `message_id` (`message_id`),
  ADD KEY `received_at_2` (`received_at`),
  ADD KEY `uid` (`uid`),
  ADD KEY `is_counted` (`is_counted`,`is_checked`);

--
-- Indexes for table `journals`
--
ALTER TABLE `journals`
  ADD PRIMARY KEY (`pk_journal`);

--
-- Indexes for table `locations`
--
ALTER TABLE `locations`
  ADD PRIMARY KEY (`pk_location`),
  ADD KEY `fk_system` (`fk_system`,`location_name`);

--
-- Indexes for table `location_groups`
--
ALTER TABLE `location_groups`
  ADD PRIMARY KEY (`pk_group`);

--
-- Indexes for table `logs`
--
ALTER TABLE `logs`
  ADD PRIMARY KEY (`pk_log`),
  ADD KEY `recorded_at` (`recorded_at`,`fk_system`,`fk_ticket`),
  ADD KEY `recorded_at_2` (`recorded_at`,`fk_system`,`fk_record`),
  ADD KEY `recorded_at_3` (`recorded_at`,`fk_system`,`fk_prop`),
  ADD KEY `recorded_at_4` (`recorded_at`,`fk_ticket`,`fk_action`),
  ADD KEY `recorded_at_5` (`recorded_at`,`fk_user`,`fk_ticket`);

--
-- Indexes for table `mailgun_events`
--
ALTER TABLE `mailgun_events`
  ADD PRIMARY KEY (`pk_mailgun_event`);

--
-- Indexes for table `messagebox_messages`
--
ALTER TABLE `messagebox_messages`
  ADD PRIMARY KEY (`pk_messagebox_message`),
  ADD KEY `fk_system` (`fk_system`,`status`,`created_at`);

--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`pk_notification`),
  ADD KEY `fk_user` (`fk_user`,`fk_ticket`),
  ADD KEY `fk_user_2` (`fk_user`,`alert_code`,`created_at`);

--
-- Indexes for table `oems`
--
ALTER TABLE `oems`
  ADD PRIMARY KEY (`pk_oem`);

--
-- Indexes for table `oem_location_links`
--
ALTER TABLE `oem_location_links`
  ADD PRIMARY KEY (`pk_oem_location_link`);

--
-- Indexes for table `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`pk_product`);

--
-- Indexes for table `product_contracts`
--
ALTER TABLE `product_contracts`
  ADD PRIMARY KEY (`pk_product_contract`);

--
-- Indexes for table `product_contract_location_links`
--
ALTER TABLE `product_contract_location_links`
  ADD PRIMARY KEY (`pk_product_contract_location_link`);

--
-- Indexes for table `product_location_links`
--
ALTER TABLE `product_location_links`
  ADD PRIMARY KEY (`pk_product_location_link`);

--
-- Indexes for table `projects`
--
ALTER TABLE `projects`
  ADD PRIMARY KEY (`pk_project`);

--
-- Indexes for table `project_budgets`
--
ALTER TABLE `project_budgets`
  ADD PRIMARY KEY (`pk_project_budget`);

--
-- Indexes for table `project_budget_approvals`
--
ALTER TABLE `project_budget_approvals`
  ADD PRIMARY KEY (`pk_project_budget_approval`);

--
-- Indexes for table `project_deps`
--
ALTER TABLE `project_deps`
  ADD PRIMARY KEY (`pk_project_dep`);

--
-- Indexes for table `project_messages`
--
ALTER TABLE `project_messages`
  ADD PRIMARY KEY (`pk_project_message`);

--
-- Indexes for table `project_notes`
--
ALTER TABLE `project_notes`
  ADD PRIMARY KEY (`pk_project_note`);

--
-- Indexes for table `project_statuses`
--
ALTER TABLE `project_statuses`
  ADD PRIMARY KEY (`pk_project_status`);

--
-- Indexes for table `project_tasks`
--
ALTER TABLE `project_tasks`
  ADD PRIMARY KEY (`pk_project_task`);

--
-- Indexes for table `project_task_notes`
--
ALTER TABLE `project_task_notes`
  ADD PRIMARY KEY (`pk_project_task_note`);

--
-- Indexes for table `project_task_statuses`
--
ALTER TABLE `project_task_statuses`
  ADD PRIMARY KEY (`pk_project_status`);

--
-- Indexes for table `project_user_links`
--
ALTER TABLE `project_user_links`
  ADD PRIMARY KEY (`pk_project_user_link`);

--
-- Indexes for table `props`
--
ALTER TABLE `props`
  ADD PRIMARY KEY (`pk_prop`),
  ADD KEY `fk_table` (`fk_table`,`fk_id`,`fk_system`,`prop_name`),
  ADD KEY `fk_table_2` (`fk_table`,`fk_id`,`fk_system`);

--
-- Indexes for table `records`
--
ALTER TABLE `records`
  ADD PRIMARY KEY (`pk_record`),
  ADD KEY `fk_system` (`fk_system`,`fk_table`,`fk_id`,`record_name`,`is_disabled`);

--
-- Indexes for table `reminders`
--
ALTER TABLE `reminders`
  ADD PRIMARY KEY (`pk_reminder`);

--
-- Indexes for table `systems`
--
ALTER TABLE `systems`
  ADD PRIMARY KEY (`pk_system`);

--
-- Indexes for table `tickets`
--
ALTER TABLE `tickets`
  ADD PRIMARY KEY (`pk_ticket`);

--
-- Indexes for table `ticket_messages`
--
ALTER TABLE `ticket_messages`
  ADD PRIMARY KEY (`pk_ticket_message`);

--
-- Indexes for table `ticket_notes`
--
ALTER TABLE `ticket_notes`
  ADD PRIMARY KEY (`pk_ticket_note`);

--
-- Indexes for table `ticket_notices`
--
ALTER TABLE `ticket_notices`
  ADD PRIMARY KEY (`pk_ticket_notice`);

--
-- Indexes for table `ticket_notice_topic_links`
--
ALTER TABLE `ticket_notice_topic_links`
  ADD PRIMARY KEY (`pk_ticket_notice_topic_link`);

--
-- Indexes for table `ticket_pings`
--
ALTER TABLE `ticket_pings`
  ADD PRIMARY KEY (`pk_ticket_ping`);

--
-- Indexes for table `ticket_sessions`
--
ALTER TABLE `ticket_sessions`
  ADD PRIMARY KEY (`pk_ticket_session`),
  ADD KEY `fk_ticket` (`fk_ticket`,`fk_user`,`start_dt`,`end_dt`,`is_active`,`is_deleted`);

--
-- Indexes for table `ticket_statuses`
--
ALTER TABLE `ticket_statuses`
  ADD PRIMARY KEY (`pk_ticket_status`);

--
-- Indexes for table `ticket_topics`
--
ALTER TABLE `ticket_topics`
  ADD PRIMARY KEY (`pk_ticket_topic`);

--
-- Indexes for table `ticket_topic_sections`
--
ALTER TABLE `ticket_topic_sections`
  ADD PRIMARY KEY (`pk_ticket_topic_section`);

--
-- Indexes for table `ticket_topic_techs`
--
ALTER TABLE `ticket_topic_techs`
  ADD PRIMARY KEY (`pk_ticket_topic_tech`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`pk_user`);

--
-- Indexes for table `user_chains`
--
ALTER TABLE `user_chains`
  ADD PRIMARY KEY (`pk_user_chain`);

--
-- Indexes for table `user_entity_links`
--
ALTER TABLE `user_entity_links`
  ADD PRIMARY KEY (`pk_user_entity_link`);

--
-- Indexes for table `user_invites`
--
ALTER TABLE `user_invites`
  ADD PRIMARY KEY (`pk_user_invite`),
  ADD KEY `fk_user` (`fk_user`),
  ADD KEY `fk_user_2` (`fk_user`,`fk_system_type`);

--
-- Indexes for table `user_perms`
--
ALTER TABLE `user_perms`
  ADD PRIMARY KEY (`pk_user_perm`);

--
-- Indexes for table `user_perm_links`
--
ALTER TABLE `user_perm_links`
  ADD PRIMARY KEY (`pk_user_perm_link`);

--
-- Indexes for table `user_reminder_links`
--
ALTER TABLE `user_reminder_links`
  ADD PRIMARY KEY (`pk_user_reminder_link`);

--
-- Indexes for table `user_system_links`
--
ALTER TABLE `user_system_links`
  ADD PRIMARY KEY (`pk_user_system_link`);

--
-- Indexes for table `user_ticket_links`
--
ALTER TABLE `user_ticket_links`
  ADD PRIMARY KEY (`pk_user_ticket_link`);

--
-- Indexes for table `user_ticket_session_links`
--
ALTER TABLE `user_ticket_session_links`
  ADD PRIMARY KEY (`pk_user_session_link`);

--
-- Indexes for table `vendors`
--
ALTER TABLE `vendors`
  ADD PRIMARY KEY (`pk_vendor`);

--
-- Indexes for table `vendor_types`
--
ALTER TABLE `vendor_types`
  ADD PRIMARY KEY (`pk_vendor_type`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `acms`
--
ALTER TABLE `acms`
  MODIFY `pk_acm` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `alerts_acms`
--
ALTER TABLE `alerts_acms`
  MODIFY `pk_alert_acm` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `alerts_backpack`
--
ALTER TABLE `alerts_backpack`
  MODIFY `pk_alert_backpack` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `calls`
--
ALTER TABLE `calls`
  MODIFY `pk_call` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `checklists`
--
ALTER TABLE `checklists`
  MODIFY `pk_checklist` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `checklist_as`
--
ALTER TABLE `checklist_as`
  MODIFY `pk_checklist_a` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `checklist_qs`
--
ALTER TABLE `checklist_qs`
  MODIFY `pk_checklist_q` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `comps`
--
ALTER TABLE `comps`
  MODIFY `pk_comp` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `comp_evidences`
--
ALTER TABLE `comp_evidences`
  MODIFY `pk_comp_evidence` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `comp_items`
--
ALTER TABLE `comp_items`
  MODIFY `pk_comp_item` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `comp_item_user_links`
--
ALTER TABLE `comp_item_user_links`
  MODIFY `pk_comp_item_user_link` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `device_tokens`
--
ALTER TABLE `device_tokens`
  MODIFY `pk_device_token` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `docs`
--
ALTER TABLE `docs`
  MODIFY `pk_doc` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `doc_types`
--
ALTER TABLE `doc_types`
  MODIFY `pk_doc_type` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `entities`
--
ALTER TABLE `entities`
  MODIFY `pk_entity` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `entity_system_links`
--
ALTER TABLE `entity_system_links`
  MODIFY `pk_entity_system_link` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `events_3cx`
--
ALTER TABLE `events_3cx`
  MODIFY `pk_event_3cx` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `events_emails`
--
ALTER TABLE `events_emails`
  MODIFY `pk_event_email` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `journals`
--
ALTER TABLE `journals`
  MODIFY `pk_journal` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `locations`
--
ALTER TABLE `locations`
  MODIFY `pk_location` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `location_groups`
--
ALTER TABLE `location_groups`
  MODIFY `pk_group` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `logs`
--
ALTER TABLE `logs`
  MODIFY `pk_log` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mailgun_events`
--
ALTER TABLE `mailgun_events`
  MODIFY `pk_mailgun_event` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `messagebox_messages`
--
ALTER TABLE `messagebox_messages`
  MODIFY `pk_messagebox_message` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `notifications`
--
ALTER TABLE `notifications`
  MODIFY `pk_notification` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `oems`
--
ALTER TABLE `oems`
  MODIFY `pk_oem` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `oem_location_links`
--
ALTER TABLE `oem_location_links`
  MODIFY `pk_oem_location_link` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
  MODIFY `pk_product` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `product_contracts`
--
ALTER TABLE `product_contracts`
  MODIFY `pk_product_contract` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `product_contract_location_links`
--
ALTER TABLE `product_contract_location_links`
  MODIFY `pk_product_contract_location_link` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `product_location_links`
--
ALTER TABLE `product_location_links`
  MODIFY `pk_product_location_link` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `projects`
--
ALTER TABLE `projects`
  MODIFY `pk_project` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `project_budgets`
--
ALTER TABLE `project_budgets`
  MODIFY `pk_project_budget` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `project_budget_approvals`
--
ALTER TABLE `project_budget_approvals`
  MODIFY `pk_project_budget_approval` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `project_deps`
--
ALTER TABLE `project_deps`
  MODIFY `pk_project_dep` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `project_messages`
--
ALTER TABLE `project_messages`
  MODIFY `pk_project_message` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `project_notes`
--
ALTER TABLE `project_notes`
  MODIFY `pk_project_note` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `project_statuses`
--
ALTER TABLE `project_statuses`
  MODIFY `pk_project_status` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `project_tasks`
--
ALTER TABLE `project_tasks`
  MODIFY `pk_project_task` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `project_task_notes`
--
ALTER TABLE `project_task_notes`
  MODIFY `pk_project_task_note` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `project_task_statuses`
--
ALTER TABLE `project_task_statuses`
  MODIFY `pk_project_status` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `project_user_links`
--
ALTER TABLE `project_user_links`
  MODIFY `pk_project_user_link` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `props`
--
ALTER TABLE `props`
  MODIFY `pk_prop` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `records`
--
ALTER TABLE `records`
  MODIFY `pk_record` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `reminders`
--
ALTER TABLE `reminders`
  MODIFY `pk_reminder` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `systems`
--
ALTER TABLE `systems`
  MODIFY `pk_system` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tickets`
--
ALTER TABLE `tickets`
  MODIFY `pk_ticket` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ticket_messages`
--
ALTER TABLE `ticket_messages`
  MODIFY `pk_ticket_message` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ticket_notices`
--
ALTER TABLE `ticket_notices`
  MODIFY `pk_ticket_notice` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ticket_notice_topic_links`
--
ALTER TABLE `ticket_notice_topic_links`
  MODIFY `pk_ticket_notice_topic_link` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ticket_pings`
--
ALTER TABLE `ticket_pings`
  MODIFY `pk_ticket_ping` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ticket_sessions`
--
ALTER TABLE `ticket_sessions`
  MODIFY `pk_ticket_session` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ticket_statuses`
--
ALTER TABLE `ticket_statuses`
  MODIFY `pk_ticket_status` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ticket_topics`
--
ALTER TABLE `ticket_topics`
  MODIFY `pk_ticket_topic` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ticket_topic_sections`
--
ALTER TABLE `ticket_topic_sections`
  MODIFY `pk_ticket_topic_section` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ticket_topic_techs`
--
ALTER TABLE `ticket_topic_techs`
  MODIFY `pk_ticket_topic_tech` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `pk_user` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_chains`
--
ALTER TABLE `user_chains`
  MODIFY `pk_user_chain` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_entity_links`
--
ALTER TABLE `user_entity_links`
  MODIFY `pk_user_entity_link` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_invites`
--
ALTER TABLE `user_invites`
  MODIFY `pk_user_invite` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_perms`
--
ALTER TABLE `user_perms`
  MODIFY `pk_user_perm` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_perm_links`
--
ALTER TABLE `user_perm_links`
  MODIFY `pk_user_perm_link` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_reminder_links`
--
ALTER TABLE `user_reminder_links`
  MODIFY `pk_user_reminder_link` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_system_links`
--
ALTER TABLE `user_system_links`
  MODIFY `pk_user_system_link` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_ticket_links`
--
ALTER TABLE `user_ticket_links`
  MODIFY `pk_user_ticket_link` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_ticket_session_links`
--
ALTER TABLE `user_ticket_session_links`
  MODIFY `pk_user_session_link` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `vendors`
--
ALTER TABLE `vendors`
  MODIFY `pk_vendor` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `vendor_types`
--
ALTER TABLE `vendor_types`
  MODIFY `pk_vendor_type` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
