/*
 Navicat Premium Data Transfer

 Source Server         : LocalServer
 Source Server Type    : MySQL
 Source Server Version : 80030 (8.0.30)
 Source Host           : localhost:3306
 Source Schema         : bwatch_demodb

 Target Server Type    : MySQL
 Target Server Version : 80030 (8.0.30)
 File Encoding         : 65001

 Date: 01/07/2023 13:13:22
*/


-- ----------------------------
-- Table structure for accept_estimates
-- ----------------------------
CREATE TABLE `accept_estimates`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `estimate_id` int UNSIGNED NOT NULL,
  `full_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `signature` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `accept_estimates_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `accept_estimates_estimate_id_foreign`(`estimate_id` ASC) USING BTREE,
  CONSTRAINT `accept_estimates_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `accept_estimates_ibfk_2` FOREIGN KEY (`estimate_id`) REFERENCES `estimates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of accept_estimates
-- ----------------------------

-- ----------------------------
-- Table structure for appreciations
-- ----------------------------
CREATE TABLE `appreciations`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `award_id` bigint UNSIGNED NOT NULL,
  `award_to` int UNSIGNED NOT NULL,
  `award_date` date NOT NULL,
  `image` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `summary` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `added_by` int UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `appreciations_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `appreciations_award_id_foreign`(`award_id` ASC) USING BTREE,
  INDEX `appreciations_award_to_foreign`(`award_to` ASC) USING BTREE,
  INDEX `appreciations_added_by_foreign`(`added_by` ASC) USING BTREE,
  CONSTRAINT `appreciations_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `appreciations_ibfk_2` FOREIGN KEY (`award_id`) REFERENCES `awards` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `appreciations_ibfk_3` FOREIGN KEY (`award_to`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `appreciations_ibfk_4` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of appreciations
-- ----------------------------

-- ----------------------------
-- Table structure for attendance_settings
-- ----------------------------
CREATE TABLE `attendance_settings`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `auto_clock_in` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `auto_clock_in_location` enum('office','home') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'office',
  `office_start_time` time NOT NULL,
  `office_end_time` time NOT NULL,
  `halfday_mark_time` time NULL DEFAULT NULL,
  `late_mark_duration` tinyint NOT NULL,
  `clockin_in_day` int NOT NULL DEFAULT 1,
  `employee_clock_in_out` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'yes',
  `office_open_days` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '[1,2,3,4,5]',
  `ip_address` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `radius` int NULL DEFAULT NULL,
  `radius_check` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `ip_check` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `alert_after` int NULL DEFAULT NULL,
  `alert_after_status` tinyint(1) NOT NULL DEFAULT 1,
  `save_current_location` tinyint(1) NOT NULL DEFAULT 0,
  `default_employee_shift` bigint UNSIGNED NULL DEFAULT 1,
  `week_start_from` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '1',
  `allow_shift_change` tinyint(1) NOT NULL DEFAULT 1,
  `show_clock_in_button` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `monthly_report` tinyint(1) NOT NULL DEFAULT 0,
  `monthly_report_roles` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `attendance_settings_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `attendance_settings_default_employee_shift_foreign`(`default_employee_shift` ASC) USING BTREE,
  CONSTRAINT `attendance_settings_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `attendance_settings_ibfk_2` FOREIGN KEY (`default_employee_shift`) REFERENCES `employee_shifts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of attendance_settings
-- ----------------------------
INSERT INTO `attendance_settings` VALUES (1, 1, 'no', 'office', '09:00:00', '18:00:00', NULL, 20, 1, 'yes', '[1,2,3,4,5]', NULL, NULL, 'no', 'no', NULL, 0, 0, 2, '1', 1, 'no', '2023-06-19 19:34:17', '2023-06-19 19:34:17', 0, NULL);

-- ----------------------------
-- Table structure for attendances
-- ----------------------------
CREATE TABLE `attendances`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `location_id` bigint UNSIGNED NULL DEFAULT NULL,
  `clock_in_time` datetime NOT NULL,
  `clock_out_time` datetime NULL DEFAULT NULL,
  `clock_in_ip` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `clock_out_ip` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `working_from` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT 'office',
  `late` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `half_day` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `latitude` decimal(10, 8) NULL DEFAULT NULL,
  `longitude` decimal(11, 8) NULL DEFAULT NULL,
  `shift_start_time` datetime NULL DEFAULT NULL,
  `shift_end_time` datetime NULL DEFAULT NULL,
  `employee_shift_id` bigint UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `work_from_type` enum('home','office','other') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'other',
  `overwrite_attendance` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `attendances_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `attendances_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `attendances_location_id_foreign`(`location_id` ASC) USING BTREE,
  INDEX `attendances_clock_in_time_index`(`clock_in_time` ASC) USING BTREE,
  INDEX `attendances_clock_out_time_index`(`clock_out_time` ASC) USING BTREE,
  INDEX `attendances_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `attendances_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  INDEX `attendances_employee_shift_id_foreign`(`employee_shift_id` ASC) USING BTREE,
  CONSTRAINT `attendances_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `attendances_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `attendances_ibfk_3` FOREIGN KEY (`employee_shift_id`) REFERENCES `employee_shifts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `attendances_ibfk_4` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `attendances_ibfk_5` FOREIGN KEY (`location_id`) REFERENCES `company_addresses` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `attendances_ibfk_6` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of attendances
-- ----------------------------

-- ----------------------------
-- Table structure for award_icons
-- ----------------------------
CREATE TABLE `award_icons`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `icon` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of award_icons
-- ----------------------------
INSERT INTO `award_icons` VALUES (1, 'Trophy', 'trophy', '2023-06-19 19:34:13', '2023-06-19 19:34:13');
INSERT INTO `award_icons` VALUES (2, 'Thumbs Up', 'hand-thumbs-up', '2023-06-19 19:34:13', '2023-06-19 19:34:13');
INSERT INTO `award_icons` VALUES (3, 'Award', 'award', '2023-06-19 19:34:13', '2023-06-19 19:34:13');
INSERT INTO `award_icons` VALUES (4, 'Book', 'book', '2023-06-19 19:34:13', '2023-06-19 19:34:13');
INSERT INTO `award_icons` VALUES (5, 'Gift', 'gift', '2023-06-19 19:34:13', '2023-06-19 19:34:13');
INSERT INTO `award_icons` VALUES (6, 'Watch', 'watch', '2023-06-19 19:34:13', '2023-06-19 19:34:13');
INSERT INTO `award_icons` VALUES (7, 'Cup', 'cup-hot', '2023-06-19 19:34:13', '2023-06-19 19:34:13');
INSERT INTO `award_icons` VALUES (8, 'Puzzle', 'puzzle', '2023-06-19 19:34:13', '2023-06-19 19:34:13');
INSERT INTO `award_icons` VALUES (9, 'Plane', 'airplane', '2023-06-19 19:34:13', '2023-06-19 19:34:13');
INSERT INTO `award_icons` VALUES (10, 'Money', 'piggy-bank', '2023-06-19 19:34:13', '2023-06-19 19:34:13');

-- ----------------------------
-- Table structure for awards
-- ----------------------------
CREATE TABLE `awards`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `award_icon_id` bigint UNSIGNED NULL DEFAULT NULL,
  `summary` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `status` enum('active','inactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active',
  `color_code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `awards_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `awards_award_icon_id_foreign`(`award_icon_id` ASC) USING BTREE,
  CONSTRAINT `awards_ibfk_1` FOREIGN KEY (`award_icon_id`) REFERENCES `award_icons` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `awards_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of awards
-- ----------------------------

-- ----------------------------
-- Table structure for bank_accounts
-- ----------------------------
CREATE TABLE `bank_accounts`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `type` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `bank_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `account_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `account_number` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `account_type` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `currency_id` int UNSIGNED NULL DEFAULT NULL,
  `contact_number` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `opening_balance` double(15, 2) NULL DEFAULT NULL,
  `bank_logo` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `status` tinyint(1) NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `bank_balance` double(16, 2) NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `bank_accounts_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `bank_accounts_currency_id_foreign`(`currency_id` ASC) USING BTREE,
  INDEX `bank_accounts_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `bank_accounts_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `bank_accounts_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `bank_accounts_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `bank_accounts_ibfk_3` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `bank_accounts_ibfk_4` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of bank_accounts
-- ----------------------------

-- ----------------------------
-- Table structure for bank_transactions
-- ----------------------------
CREATE TABLE `bank_transactions`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `bank_account_id` int UNSIGNED NULL DEFAULT NULL,
  `payment_id` int UNSIGNED NULL DEFAULT NULL,
  `invoice_id` int UNSIGNED NULL DEFAULT NULL,
  `expense_id` int UNSIGNED NULL DEFAULT NULL,
  `amount` double(15, 2) NULL DEFAULT NULL,
  `type` enum('Cr','Dr') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Cr',
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `memo` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `transaction_relation` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `transaction_related_to` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `title` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `transaction_date` date NULL DEFAULT NULL,
  `bank_balance` double(16, 2) NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `bank_transactions_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `bank_transactions_bank_account_id_foreign`(`bank_account_id` ASC) USING BTREE,
  INDEX `bank_transactions_payment_id_foreign`(`payment_id` ASC) USING BTREE,
  INDEX `bank_transactions_invoice_id_foreign`(`invoice_id` ASC) USING BTREE,
  INDEX `bank_transactions_expense_id_foreign`(`expense_id` ASC) USING BTREE,
  INDEX `bank_transactions_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `bank_transactions_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `bank_transactions_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `bank_transactions_ibfk_2` FOREIGN KEY (`bank_account_id`) REFERENCES `bank_accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `bank_transactions_ibfk_3` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `bank_transactions_ibfk_4` FOREIGN KEY (`expense_id`) REFERENCES `expenses` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `bank_transactions_ibfk_5` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `bank_transactions_ibfk_6` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `bank_transactions_ibfk_7` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of bank_transactions
-- ----------------------------

-- ----------------------------
-- Table structure for client_categories
-- ----------------------------
CREATE TABLE `client_categories`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `category_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `client_categories_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `client_categories_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of client_categories
-- ----------------------------

-- ----------------------------
-- Table structure for client_contacts
-- ----------------------------
CREATE TABLE `client_contacts`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `contact_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `email` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `client_contacts_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `client_contacts_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `client_contacts_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `client_contacts_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `client_contacts_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `client_contacts_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `client_contacts_ibfk_3` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `client_contacts_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of client_contacts
-- ----------------------------

-- ----------------------------
-- Table structure for client_details
-- ----------------------------
CREATE TABLE `client_details`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `company_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `address` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `shipping_address` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `postal_code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `state` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `city` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `office` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `website` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `linkedin` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `facebook` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `twitter` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `skype` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `gst_number` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `category_id` bigint UNSIGNED NULL DEFAULT NULL,
  `sub_category_id` bigint UNSIGNED NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `company_logo` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `quickbooks_client_id` int NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `client_details_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `client_details_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `client_details_category_id_foreign`(`category_id` ASC) USING BTREE,
  INDEX `client_details_sub_category_id_foreign`(`sub_category_id` ASC) USING BTREE,
  INDEX `client_details_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `client_details_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `client_details_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `client_details_ibfk_2` FOREIGN KEY (`category_id`) REFERENCES `client_categories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `client_details_ibfk_3` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `client_details_ibfk_4` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `client_details_ibfk_5` FOREIGN KEY (`sub_category_id`) REFERENCES `client_sub_categories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `client_details_ibfk_6` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of client_details
-- ----------------------------
INSERT INTO `client_details` VALUES (1, 1, 10, 'END', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, '2023-06-23 07:39:31', '2023-06-23 07:39:31', NULL);
INSERT INTO `client_details` VALUES (2, 1, 11, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '<p><br></p>', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 2, NULL, '2023-06-23 09:52:51', '2023-06-27 10:14:10', NULL);

-- ----------------------------
-- Table structure for client_docs
-- ----------------------------
CREATE TABLE `client_docs`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `filename` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `hashname` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `size` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `client_docs_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `client_docs_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `client_docs_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `client_docs_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `client_docs_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `client_docs_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `client_docs_ibfk_3` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `client_docs_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of client_docs
-- ----------------------------

-- ----------------------------
-- Table structure for client_notes
-- ----------------------------
CREATE TABLE `client_notes`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `client_id` int UNSIGNED NULL DEFAULT NULL,
  `title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` tinyint(1) NOT NULL DEFAULT 0,
  `member_id` int UNSIGNED NULL DEFAULT NULL,
  `is_client_show` tinyint(1) NOT NULL DEFAULT 0,
  `ask_password` tinyint(1) NOT NULL DEFAULT 0,
  `details` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `client_notes_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `client_notes_client_id_foreign`(`client_id` ASC) USING BTREE,
  INDEX `client_notes_member_id_foreign`(`member_id` ASC) USING BTREE,
  INDEX `client_notes_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `client_notes_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `client_notes_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `client_notes_ibfk_2` FOREIGN KEY (`client_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `client_notes_ibfk_3` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `client_notes_ibfk_4` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `client_notes_ibfk_5` FOREIGN KEY (`member_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of client_notes
-- ----------------------------

-- ----------------------------
-- Table structure for client_sub_categories
-- ----------------------------
CREATE TABLE `client_sub_categories`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `category_id` bigint UNSIGNED NOT NULL,
  `category_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `client_sub_categories_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `client_sub_categories_category_id_foreign`(`category_id` ASC) USING BTREE,
  CONSTRAINT `client_sub_categories_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `client_categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `client_sub_categories_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of client_sub_categories
-- ----------------------------

-- ----------------------------
-- Table structure for client_user_notes
-- ----------------------------
CREATE TABLE `client_user_notes`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `client_note_id` int UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `client_user_notes_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `client_user_notes_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `client_user_notes_client_note_id_foreign`(`client_note_id` ASC) USING BTREE,
  CONSTRAINT `client_user_notes_ibfk_1` FOREIGN KEY (`client_note_id`) REFERENCES `client_notes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `client_user_notes_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `client_user_notes_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of client_user_notes
-- ----------------------------

-- ----------------------------
-- Table structure for companies
-- ----------------------------
CREATE TABLE `companies`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `app_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `company_email` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `company_phone` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `logo` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `light_logo` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `favicon` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `auth_theme` enum('dark','light') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'light',
  `auth_theme_text` enum('dark','light') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'dark',
  `sidebar_logo_style` enum('square','full') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'square',
  `login_background` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `address` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `website` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `currency_id` int UNSIGNED NULL DEFAULT NULL,
  `timezone` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Asia/Kolkata',
  `date_format` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'd-m-Y',
  `date_picker_format` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'dd-mm-yyyy',
  `year_starts_from` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '1',
  `moment_format` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DD-MM-YYYY',
  `time_format` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'h:i a',
  `locale` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'en',
  `latitude` decimal(10, 8) NOT NULL DEFAULT 26.91243360,
  `longitude` decimal(11, 8) NOT NULL DEFAULT 75.78727090,
  `leaves_start_from` enum('joining_date','year_start') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'joining_date',
  `active_theme` enum('default','custom') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default',
  `status` enum('active','inactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active',
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `google_map_key` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `task_self` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'yes',
  `rounded_theme` tinyint(1) NOT NULL DEFAULT 1,
  `logo_background_color` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#ffffff',
  `header_color` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#1D82F5',
  `before_days` int NOT NULL,
  `after_days` int NOT NULL,
  `on_deadline` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'yes',
  `default_task_status` int UNSIGNED NULL DEFAULT NULL,
  `dashboard_clock` tinyint(1) NOT NULL DEFAULT 1,
  `ticket_form_google_captcha` tinyint(1) NOT NULL DEFAULT 0,
  `lead_form_google_captcha` tinyint(1) NOT NULL DEFAULT 0,
  `taskboard_length` int NOT NULL DEFAULT 10,
  `datatable_row_limit` int NOT NULL DEFAULT 10,
  `allow_client_signup` tinyint(1) NOT NULL,
  `admin_client_signup_approval` tinyint(1) NOT NULL,
  `google_calendar_status` enum('active','inactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'inactive',
  `google_client_id` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `google_client_secret` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `google_calendar_verification_status` enum('verified','non_verified') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'non_verified',
  `google_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `token` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `hash` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `last_login` datetime NULL DEFAULT NULL,
  `rtl` tinyint(1) NOT NULL DEFAULT 0,
  `show_new_webhook_alert` tinyint(1) NOT NULL DEFAULT 0,
  `pm_type` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `pm_last_four` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `companies_currency_id_foreign`(`currency_id` ASC) USING BTREE,
  INDEX `companies_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  INDEX `companies_default_task_status_foreign`(`default_task_status` ASC) USING BTREE,
  CONSTRAINT `companies_ibfk_1` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `companies_ibfk_2` FOREIGN KEY (`default_task_status`) REFERENCES `taskboard_columns` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  CONSTRAINT `companies_ibfk_3` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of companies
-- ----------------------------
INSERT INTO `companies` VALUES (1, 'BWatch', 'BWatch', 'company@email.com', '1234567891', '713d45ffca831468c17844a797f07f08.png', '33f0c9c2178178fd820e9e0f7b19e5f1.png', 'dc9f613b444dded14ae8811ed3705883.png', 'light', 'dark', 'square', NULL, 'Your Company address here', 'https://worksuite.biz', 1, 'Asia/Kolkata', 'd-m-Y', 'dd-mm-yyyy', '1', 'DD-MM-YYYY', 'h:i a', 'en', 26.91243360, 75.78727090, 'joining_date', 'default', 'active', 1, NULL, 'yes', 1, '#FFFFFF', '#231F20', 0, 0, 'yes', 1, 1, 0, 0, 10, 10, 0, 0, 'inactive', NULL, NULL, 'non_verified', NULL, NULL, NULL, '96d2796df116a55106b7a83ebf06f6ec', '2023-06-19 19:34:16', '2023-06-27 12:16:14', NULL, 0, 0, NULL, NULL);

-- ----------------------------
-- Table structure for company_addresses
-- ----------------------------
CREATE TABLE `company_addresses`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `address` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_default` tinyint(1) NOT NULL,
  `tax_number` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `tax_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `location` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `latitude` decimal(10, 8) NULL DEFAULT NULL,
  `longitude` decimal(11, 8) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `company_addresses_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `company_addresses_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of company_addresses
-- ----------------------------
INSERT INTO `company_addresses` VALUES (1, 1, 'Your Company address here', 1, NULL, NULL, 'Worksuite', '2023-06-19 19:34:16', '2023-06-19 19:34:16', NULL, NULL);

-- ----------------------------
-- Table structure for contract_discussions
-- ----------------------------
CREATE TABLE `contract_discussions`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `contract_id` bigint UNSIGNED NOT NULL,
  `from` int UNSIGNED NOT NULL,
  `message` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `contract_discussions_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `contract_discussions_contract_id_foreign`(`contract_id` ASC) USING BTREE,
  INDEX `contract_discussions_from_foreign`(`from` ASC) USING BTREE,
  INDEX `contract_discussions_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `contract_discussions_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `contract_discussions_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `contract_discussions_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `contract_discussions_ibfk_3` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `contract_discussions_ibfk_4` FOREIGN KEY (`from`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `contract_discussions_ibfk_5` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of contract_discussions
-- ----------------------------

-- ----------------------------
-- Table structure for contract_files
-- ----------------------------
CREATE TABLE `contract_files`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `contract_id` bigint UNSIGNED NOT NULL,
  `filename` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `hashname` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `size` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `google_url` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `dropbox_link` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `external_link_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `external_link` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `contract_files_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `contract_files_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `contract_files_contract_id_foreign`(`contract_id` ASC) USING BTREE,
  INDEX `contract_files_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `contract_files_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `contract_files_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `contract_files_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `contract_files_ibfk_3` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `contract_files_ibfk_4` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `contract_files_ibfk_5` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of contract_files
-- ----------------------------

-- ----------------------------
-- Table structure for contract_renews
-- ----------------------------
CREATE TABLE `contract_renews`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `renewed_by` int UNSIGNED NOT NULL,
  `contract_id` bigint UNSIGNED NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `amount` decimal(12, 2) NOT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `contract_renews_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `contract_renews_renewed_by_foreign`(`renewed_by` ASC) USING BTREE,
  INDEX `contract_renews_contract_id_foreign`(`contract_id` ASC) USING BTREE,
  INDEX `contract_renews_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `contract_renews_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `contract_renews_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `contract_renews_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `contract_renews_ibfk_3` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `contract_renews_ibfk_4` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `contract_renews_ibfk_5` FOREIGN KEY (`renewed_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of contract_renews
-- ----------------------------

-- ----------------------------
-- Table structure for contract_signs
-- ----------------------------
CREATE TABLE `contract_signs`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `contract_id` bigint UNSIGNED NOT NULL,
  `full_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `signature` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `place` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `date` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `contract_signs_contract_id_foreign`(`contract_id` ASC) USING BTREE,
  INDEX `contract_signs_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `contract_signs_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `contract_signs_ibfk_2` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of contract_signs
-- ----------------------------

-- ----------------------------
-- Table structure for contract_templates
-- ----------------------------
CREATE TABLE `contract_templates`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `contract_template_number` bigint NULL DEFAULT NULL,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `subject` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `amount` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `contract_type_id` bigint UNSIGNED NOT NULL,
  `currency_id` int UNSIGNED NULL DEFAULT NULL,
  `contract_detail` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `added_by` int NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `contract_templates_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `contract_templates_contract_type_id_foreign`(`contract_type_id` ASC) USING BTREE,
  INDEX `contract_templates_currency_id_foreign`(`currency_id` ASC) USING BTREE,
  CONSTRAINT `contract_templates_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `contract_templates_ibfk_2` FOREIGN KEY (`contract_type_id`) REFERENCES `contract_types` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `contract_templates_ibfk_3` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of contract_templates
-- ----------------------------

-- ----------------------------
-- Table structure for contract_types
-- ----------------------------
CREATE TABLE `contract_types`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `contract_types_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `contract_types_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of contract_types
-- ----------------------------

-- ----------------------------
-- Table structure for contracts
-- ----------------------------
CREATE TABLE `contracts`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `contract_number` bigint NULL DEFAULT NULL,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `client_id` int UNSIGNED NOT NULL,
  `project_id` int UNSIGNED NULL DEFAULT NULL,
  `subject` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `original_amount` decimal(15, 2) NOT NULL,
  `contract_type_id` bigint UNSIGNED NULL DEFAULT NULL,
  `start_date` date NOT NULL,
  `original_start_date` date NOT NULL,
  `end_date` date NULL DEFAULT NULL,
  `original_end_date` date NULL DEFAULT NULL,
  `description` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `contract_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `alternate_address` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `contract_note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `cell` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `office` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `city` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `state` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `country` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `postal_code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `contract_detail` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `hash` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `currency_id` int UNSIGNED NULL DEFAULT NULL,
  `event_id` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `company_sign` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `sign_date` date NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `contracts_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `contracts_client_id_foreign`(`client_id` ASC) USING BTREE,
  INDEX `contracts_contract_type_id_foreign`(`contract_type_id` ASC) USING BTREE,
  INDEX `contracts_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `contracts_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  INDEX `contracts_currency_id_foreign`(`currency_id` ASC) USING BTREE,
  INDEX `contracts_project_id_foreign`(`project_id` ASC) USING BTREE,
  CONSTRAINT `contracts_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `contracts_ibfk_2` FOREIGN KEY (`client_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `contracts_ibfk_3` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `contracts_ibfk_4` FOREIGN KEY (`contract_type_id`) REFERENCES `contract_types` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `contracts_ibfk_5` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `contracts_ibfk_6` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `contracts_ibfk_7` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of contracts
-- ----------------------------

-- ----------------------------
-- Table structure for conversation
-- ----------------------------
CREATE TABLE `conversation`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `user_one` int UNSIGNED NOT NULL,
  `user_two` int UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `conversation_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `conversation_user_one_foreign`(`user_one` ASC) USING BTREE,
  INDEX `conversation_user_two_foreign`(`user_two` ASC) USING BTREE,
  CONSTRAINT `conversation_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of conversation
-- ----------------------------

-- ----------------------------
-- Table structure for conversation_reply
-- ----------------------------
CREATE TABLE `conversation_reply`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `conversation_id` int UNSIGNED NOT NULL,
  `reply` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `conversation_reply_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `conversation_reply_conversation_id_foreign`(`conversation_id` ASC) USING BTREE,
  INDEX `conversation_reply_user_id_foreign`(`user_id` ASC) USING BTREE,
  CONSTRAINT `conversation_reply_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `conversation_reply_ibfk_2` FOREIGN KEY (`conversation_id`) REFERENCES `conversation` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `conversation_reply_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of conversation_reply
-- ----------------------------

-- ----------------------------
-- Table structure for countries
-- ----------------------------
CREATE TABLE `countries`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `iso` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `nicename` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `iso3` char(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `numcode` smallint NULL DEFAULT NULL,
  `phonecode` int NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 254 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of countries
-- ----------------------------
INSERT INTO `countries` VALUES (1, 'AF', 'AFGHANISTAN', 'Afghanistan', 'AFG', 4, 93);
INSERT INTO `countries` VALUES (2, 'AL', 'ALBANIA', 'Albania', 'ALB', 8, 355);
INSERT INTO `countries` VALUES (3, 'DZ', 'ALGERIA', 'Algeria', 'DZA', 12, 213);
INSERT INTO `countries` VALUES (4, 'AS', 'AMERICAN SAMOA', 'American Samoa', 'ASM', 16, 1684);
INSERT INTO `countries` VALUES (5, 'AD', 'ANDORRA', 'Andorra', 'AND', 20, 376);
INSERT INTO `countries` VALUES (6, 'AO', 'ANGOLA', 'Angola', 'AGO', 24, 244);
INSERT INTO `countries` VALUES (7, 'AI', 'ANGUILLA', 'Anguilla', 'AIA', 660, 1264);
INSERT INTO `countries` VALUES (8, 'AQ', 'ANTARCTICA', 'Antarctica', NULL, NULL, 0);
INSERT INTO `countries` VALUES (9, 'AG', 'ANTIGUA AND BARBUDA', 'Antigua and Barbuda', 'ATG', 28, 1268);
INSERT INTO `countries` VALUES (10, 'AR', 'ARGENTINA', 'Argentina', 'ARG', 32, 54);
INSERT INTO `countries` VALUES (11, 'AM', 'ARMENIA', 'Armenia', 'ARM', 51, 374);
INSERT INTO `countries` VALUES (12, 'AW', 'ARUBA', 'Aruba', 'ABW', 533, 297);
INSERT INTO `countries` VALUES (13, 'AU', 'AUSTRALIA', 'Australia', 'AUS', 36, 61);
INSERT INTO `countries` VALUES (14, 'AT', 'AUSTRIA', 'Austria', 'AUT', 40, 43);
INSERT INTO `countries` VALUES (15, 'AZ', 'AZERBAIJAN', 'Azerbaijan', 'AZE', 31, 994);
INSERT INTO `countries` VALUES (16, 'BS', 'BAHAMAS', 'Bahamas', 'BHS', 44, 1242);
INSERT INTO `countries` VALUES (17, 'BH', 'BAHRAIN', 'Bahrain', 'BHR', 48, 973);
INSERT INTO `countries` VALUES (18, 'BD', 'BANGLADESH', 'Bangladesh', 'BGD', 50, 880);
INSERT INTO `countries` VALUES (19, 'BB', 'BARBADOS', 'Barbados', 'BRB', 52, 1246);
INSERT INTO `countries` VALUES (20, 'BY', 'BELARUS', 'Belarus', 'BLR', 112, 375);
INSERT INTO `countries` VALUES (21, 'BE', 'BELGIUM', 'Belgium', 'BEL', 56, 32);
INSERT INTO `countries` VALUES (22, 'BZ', 'BELIZE', 'Belize', 'BLZ', 84, 501);
INSERT INTO `countries` VALUES (23, 'BJ', 'BENIN', 'Benin', 'BEN', 204, 229);
INSERT INTO `countries` VALUES (24, 'BM', 'BERMUDA', 'Bermuda', 'BMU', 60, 1441);
INSERT INTO `countries` VALUES (25, 'BT', 'BHUTAN', 'Bhutan', 'BTN', 64, 975);
INSERT INTO `countries` VALUES (26, 'BO', 'BOLIVIA', 'Bolivia', 'BOL', 68, 591);
INSERT INTO `countries` VALUES (27, 'BA', 'BOSNIA AND HERZEGOVINA', 'Bosnia and Herzegovina', 'BIH', 70, 387);
INSERT INTO `countries` VALUES (28, 'BW', 'BOTSWANA', 'Botswana', 'BWA', 72, 267);
INSERT INTO `countries` VALUES (29, 'BV', 'BOUVET ISLAND', 'Bouvet Island', NULL, NULL, 0);
INSERT INTO `countries` VALUES (30, 'BR', 'BRAZIL', 'Brazil', 'BRA', 76, 55);
INSERT INTO `countries` VALUES (31, 'IO', 'BRITISH INDIAN OCEAN TERRITORY', 'British Indian Ocean Territory', NULL, NULL, 246);
INSERT INTO `countries` VALUES (32, 'BN', 'BRUNEI DARUSSALAM', 'Brunei Darussalam', 'BRN', 96, 673);
INSERT INTO `countries` VALUES (33, 'BG', 'BULGARIA', 'Bulgaria', 'BGR', 100, 359);
INSERT INTO `countries` VALUES (34, 'BF', 'BURKINA FASO', 'Burkina Faso', 'BFA', 854, 226);
INSERT INTO `countries` VALUES (35, 'BI', 'BURUNDI', 'Burundi', 'BDI', 108, 257);
INSERT INTO `countries` VALUES (36, 'KH', 'CAMBODIA', 'Cambodia', 'KHM', 116, 855);
INSERT INTO `countries` VALUES (37, 'CM', 'CAMEROON', 'Cameroon', 'CMR', 120, 237);
INSERT INTO `countries` VALUES (38, 'CA', 'CANADA', 'Canada', 'CAN', 124, 1);
INSERT INTO `countries` VALUES (39, 'CV', 'CAPE VERDE', 'Cape Verde', 'CPV', 132, 238);
INSERT INTO `countries` VALUES (40, 'KY', 'CAYMAN ISLANDS', 'Cayman Islands', 'CYM', 136, 1345);
INSERT INTO `countries` VALUES (41, 'CF', 'CENTRAL AFRICAN REPUBLIC', 'Central African Republic', 'CAF', 140, 236);
INSERT INTO `countries` VALUES (42, 'TD', 'CHAD', 'Chad', 'TCD', 148, 235);
INSERT INTO `countries` VALUES (43, 'CL', 'CHILE', 'Chile', 'CHL', 152, 56);
INSERT INTO `countries` VALUES (44, 'CN', 'CHINA', 'China', 'CHN', 156, 86);
INSERT INTO `countries` VALUES (45, 'CX', 'CHRISTMAS ISLAND', 'Christmas Island', NULL, NULL, 61);
INSERT INTO `countries` VALUES (46, 'CC', 'COCOS (KEELING) ISLANDS', 'Cocos (Keeling) Islands', NULL, NULL, 672);
INSERT INTO `countries` VALUES (47, 'CO', 'COLOMBIA', 'Colombia', 'COL', 170, 57);
INSERT INTO `countries` VALUES (48, 'KM', 'COMOROS', 'Comoros', 'COM', 174, 269);
INSERT INTO `countries` VALUES (49, 'CG', 'CONGO', 'Congo', 'COG', 178, 242);
INSERT INTO `countries` VALUES (50, 'CD', 'CONGO, THE DEMOCRATIC REPUBLIC OF THE', 'Congo, the Democratic Republic of the', 'COD', 180, 242);
INSERT INTO `countries` VALUES (51, 'CK', 'COOK ISLANDS', 'Cook Islands', 'COK', 184, 682);
INSERT INTO `countries` VALUES (52, 'CR', 'COSTA RICA', 'Costa Rica', 'CRI', 188, 506);
INSERT INTO `countries` VALUES (53, 'CI', 'COTE D\'IVOIRE', 'Cote D\'Ivoire', 'CIV', 384, 225);
INSERT INTO `countries` VALUES (54, 'HR', 'CROATIA', 'Croatia', 'HRV', 191, 385);
INSERT INTO `countries` VALUES (55, 'CU', 'CUBA', 'Cuba', 'CUB', 192, 53);
INSERT INTO `countries` VALUES (56, 'CY', 'CYPRUS', 'Cyprus', 'CYP', 196, 357);
INSERT INTO `countries` VALUES (57, 'CZ', 'CZECH REPUBLIC', 'Czech Republic', 'CZE', 203, 420);
INSERT INTO `countries` VALUES (58, 'DK', 'DENMARK', 'Denmark', 'DNK', 208, 45);
INSERT INTO `countries` VALUES (59, 'DJ', 'DJIBOUTI', 'Djibouti', 'DJI', 262, 253);
INSERT INTO `countries` VALUES (60, 'DM', 'DOMINICA', 'Dominica', 'DMA', 212, 1767);
INSERT INTO `countries` VALUES (61, 'DO', 'DOMINICAN REPUBLIC', 'Dominican Republic', 'DOM', 214, 1809);
INSERT INTO `countries` VALUES (62, 'EC', 'ECUADOR', 'Ecuador', 'ECU', 218, 593);
INSERT INTO `countries` VALUES (63, 'EG', 'EGYPT', 'Egypt', 'EGY', 818, 20);
INSERT INTO `countries` VALUES (64, 'SV', 'EL SALVADOR', 'El Salvador', 'SLV', 222, 503);
INSERT INTO `countries` VALUES (65, 'GQ', 'EQUATORIAL GUINEA', 'Equatorial Guinea', 'GNQ', 226, 240);
INSERT INTO `countries` VALUES (66, 'ER', 'ERITREA', 'Eritrea', 'ERI', 232, 291);
INSERT INTO `countries` VALUES (67, 'EE', 'ESTONIA', 'Estonia', 'EST', 233, 372);
INSERT INTO `countries` VALUES (68, 'ET', 'ETHIOPIA', 'Ethiopia', 'ETH', 231, 251);
INSERT INTO `countries` VALUES (69, 'FK', 'FALKLAND ISLANDS (MALVINAS)', 'Falkland Islands (Malvinas)', 'FLK', 238, 500);
INSERT INTO `countries` VALUES (70, 'FO', 'FAROE ISLANDS', 'Faroe Islands', 'FRO', 234, 298);
INSERT INTO `countries` VALUES (71, 'FJ', 'FIJI', 'Fiji', 'FJI', 242, 679);
INSERT INTO `countries` VALUES (72, 'FI', 'FINLAND', 'Finland', 'FIN', 246, 358);
INSERT INTO `countries` VALUES (73, 'FR', 'FRANCE', 'France', 'FRA', 250, 33);
INSERT INTO `countries` VALUES (74, 'GF', 'FRENCH GUIANA', 'French Guiana', 'GUF', 254, 594);
INSERT INTO `countries` VALUES (75, 'PF', 'FRENCH POLYNESIA', 'French Polynesia', 'PYF', 258, 689);
INSERT INTO `countries` VALUES (76, 'TF', 'FRENCH SOUTHERN TERRITORIES', 'French Southern Territories', NULL, NULL, 0);
INSERT INTO `countries` VALUES (77, 'GA', 'GABON', 'Gabon', 'GAB', 266, 241);
INSERT INTO `countries` VALUES (78, 'GM', 'GAMBIA', 'Gambia', 'GMB', 270, 220);
INSERT INTO `countries` VALUES (79, 'GE', 'GEORGIA', 'Georgia', 'GEO', 268, 995);
INSERT INTO `countries` VALUES (80, 'DE', 'GERMANY', 'Germany', 'DEU', 276, 49);
INSERT INTO `countries` VALUES (81, 'GH', 'GHANA', 'Ghana', 'GHA', 288, 233);
INSERT INTO `countries` VALUES (82, 'GI', 'GIBRALTAR', 'Gibraltar', 'GIB', 292, 350);
INSERT INTO `countries` VALUES (83, 'GR', 'GREECE', 'Greece', 'GRC', 300, 30);
INSERT INTO `countries` VALUES (84, 'GL', 'GREENLAND', 'Greenland', 'GRL', 304, 299);
INSERT INTO `countries` VALUES (85, 'GD', 'GRENADA', 'Grenada', 'GRD', 308, 1473);
INSERT INTO `countries` VALUES (86, 'GP', 'GUADELOUPE', 'Guadeloupe', 'GLP', 312, 590);
INSERT INTO `countries` VALUES (87, 'GU', 'GUAM', 'Guam', 'GUM', 316, 1671);
INSERT INTO `countries` VALUES (88, 'GT', 'GUATEMALA', 'Guatemala', 'GTM', 320, 502);
INSERT INTO `countries` VALUES (89, 'GN', 'GUINEA', 'Guinea', 'GIN', 324, 224);
INSERT INTO `countries` VALUES (90, 'GW', 'GUINEA-BISSAU', 'Guinea-Bissau', 'GNB', 624, 245);
INSERT INTO `countries` VALUES (91, 'GY', 'GUYANA', 'Guyana', 'GUY', 328, 592);
INSERT INTO `countries` VALUES (92, 'HT', 'HAITI', 'Haiti', 'HTI', 332, 509);
INSERT INTO `countries` VALUES (93, 'HM', 'HEARD ISLAND AND MCDONALD ISLANDS', 'Heard Island and Mcdonald Islands', NULL, NULL, 0);
INSERT INTO `countries` VALUES (94, 'VA', 'HOLY SEE (VATICAN CITY STATE)', 'Holy See (Vatican City State)', 'VAT', 336, 39);
INSERT INTO `countries` VALUES (95, 'HN', 'HONDURAS', 'Honduras', 'HND', 340, 504);
INSERT INTO `countries` VALUES (96, 'HK', 'HONG KONG', 'Hong Kong', 'HKG', 344, 852);
INSERT INTO `countries` VALUES (97, 'HU', 'HUNGARY', 'Hungary', 'HUN', 348, 36);
INSERT INTO `countries` VALUES (98, 'IS', 'ICELAND', 'Iceland', 'ISL', 352, 354);
INSERT INTO `countries` VALUES (99, 'IN', 'INDIA', 'India', 'IND', 356, 91);
INSERT INTO `countries` VALUES (100, 'ID', 'INDONESIA', 'Indonesia', 'IDN', 360, 62);
INSERT INTO `countries` VALUES (101, 'IR', 'IRAN, ISLAMIC REPUBLIC OF', 'Iran, Islamic Republic of', 'IRN', 364, 98);
INSERT INTO `countries` VALUES (102, 'IQ', 'IRAQ', 'Iraq', 'IRQ', 368, 964);
INSERT INTO `countries` VALUES (103, 'IE', 'IRELAND', 'Ireland', 'IRL', 372, 353);
INSERT INTO `countries` VALUES (104, 'IL', 'ISRAEL', 'Israel', 'ISR', 376, 972);
INSERT INTO `countries` VALUES (105, 'IT', 'ITALY', 'Italy', 'ITA', 380, 39);
INSERT INTO `countries` VALUES (106, 'JM', 'JAMAICA', 'Jamaica', 'JAM', 388, 1876);
INSERT INTO `countries` VALUES (107, 'JP', 'JAPAN', 'Japan', 'JPN', 392, 81);
INSERT INTO `countries` VALUES (108, 'JO', 'JORDAN', 'Jordan', 'JOR', 400, 962);
INSERT INTO `countries` VALUES (109, 'KZ', 'KAZAKHSTAN', 'Kazakhstan', 'KAZ', 398, 7);
INSERT INTO `countries` VALUES (110, 'KE', 'KENYA', 'Kenya', 'KEN', 404, 254);
INSERT INTO `countries` VALUES (111, 'KI', 'KIRIBATI', 'Kiribati', 'KIR', 296, 686);
INSERT INTO `countries` VALUES (112, 'KP', 'KOREA, DEMOCRATIC PEOPLE\'S REPUBLIC OF', 'Korea, Democratic People\'s Republic of', 'PRK', 408, 850);
INSERT INTO `countries` VALUES (113, 'KR', 'KOREA, REPUBLIC OF', 'Korea, Republic of', 'KOR', 410, 82);
INSERT INTO `countries` VALUES (114, 'KW', 'KUWAIT', 'Kuwait', 'KWT', 414, 965);
INSERT INTO `countries` VALUES (115, 'KG', 'KYRGYZSTAN', 'Kyrgyzstan', 'KGZ', 417, 996);
INSERT INTO `countries` VALUES (116, 'LA', 'LAO PEOPLE\'S DEMOCRATIC REPUBLIC', 'Lao People\'s Democratic Republic', 'LAO', 418, 856);
INSERT INTO `countries` VALUES (117, 'LV', 'LATVIA', 'Latvia', 'LVA', 428, 371);
INSERT INTO `countries` VALUES (118, 'LB', 'LEBANON', 'Lebanon', 'LBN', 422, 961);
INSERT INTO `countries` VALUES (119, 'LS', 'LESOTHO', 'Lesotho', 'LSO', 426, 266);
INSERT INTO `countries` VALUES (120, 'LR', 'LIBERIA', 'Liberia', 'LBR', 430, 231);
INSERT INTO `countries` VALUES (121, 'LY', 'LIBYAN ARAB JAMAHIRIYA', 'Libyan Arab Jamahiriya', 'LBY', 434, 218);
INSERT INTO `countries` VALUES (122, 'LI', 'LIECHTENSTEIN', 'Liechtenstein', 'LIE', 438, 423);
INSERT INTO `countries` VALUES (123, 'LT', 'LITHUANIA', 'Lithuania', 'LTU', 440, 370);
INSERT INTO `countries` VALUES (124, 'LU', 'LUXEMBOURG', 'Luxembourg', 'LUX', 442, 352);
INSERT INTO `countries` VALUES (125, 'MO', 'MACAO', 'Macao', 'MAC', 446, 853);
INSERT INTO `countries` VALUES (126, 'MK', 'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF', 'Macedonia, the Former Yugoslav Republic of', 'MKD', 807, 389);
INSERT INTO `countries` VALUES (127, 'MG', 'MADAGASCAR', 'Madagascar', 'MDG', 450, 261);
INSERT INTO `countries` VALUES (128, 'MW', 'MALAWI', 'Malawi', 'MWI', 454, 265);
INSERT INTO `countries` VALUES (129, 'MY', 'MALAYSIA', 'Malaysia', 'MYS', 458, 60);
INSERT INTO `countries` VALUES (130, 'MV', 'MALDIVES', 'Maldives', 'MDV', 462, 960);
INSERT INTO `countries` VALUES (131, 'ML', 'MALI', 'Mali', 'MLI', 466, 223);
INSERT INTO `countries` VALUES (132, 'MT', 'MALTA', 'Malta', 'MLT', 470, 356);
INSERT INTO `countries` VALUES (133, 'MH', 'MARSHALL ISLANDS', 'Marshall Islands', 'MHL', 584, 692);
INSERT INTO `countries` VALUES (134, 'MQ', 'MARTINIQUE', 'Martinique', 'MTQ', 474, 596);
INSERT INTO `countries` VALUES (135, 'MR', 'MAURITANIA', 'Mauritania', 'MRT', 478, 222);
INSERT INTO `countries` VALUES (136, 'MU', 'MAURITIUS', 'Mauritius', 'MUS', 480, 230);
INSERT INTO `countries` VALUES (137, 'YT', 'MAYOTTE', 'Mayotte', NULL, NULL, 269);
INSERT INTO `countries` VALUES (138, 'MX', 'MEXICO', 'Mexico', 'MEX', 484, 52);
INSERT INTO `countries` VALUES (139, 'FM', 'MICRONESIA, FEDERATED STATES OF', 'Micronesia, Federated States of', 'FSM', 583, 691);
INSERT INTO `countries` VALUES (140, 'MD', 'MOLDOVA, REPUBLIC OF', 'Moldova, Republic of', 'MDA', 498, 373);
INSERT INTO `countries` VALUES (141, 'MC', 'MONACO', 'Monaco', 'MCO', 492, 377);
INSERT INTO `countries` VALUES (142, 'MN', 'MONGOLIA', 'Mongolia', 'MNG', 496, 976);
INSERT INTO `countries` VALUES (143, 'MS', 'MONTSERRAT', 'Montserrat', 'MSR', 500, 1664);
INSERT INTO `countries` VALUES (144, 'MA', 'MOROCCO', 'Morocco', 'MAR', 504, 212);
INSERT INTO `countries` VALUES (145, 'MZ', 'MOZAMBIQUE', 'Mozambique', 'MOZ', 508, 258);
INSERT INTO `countries` VALUES (146, 'MM', 'MYANMAR', 'Myanmar', 'MMR', 104, 95);
INSERT INTO `countries` VALUES (147, 'NA', 'NAMIBIA', 'Namibia', 'NAM', 516, 264);
INSERT INTO `countries` VALUES (148, 'NR', 'NAURU', 'Nauru', 'NRU', 520, 674);
INSERT INTO `countries` VALUES (149, 'NP', 'NEPAL', 'Nepal', 'NPL', 524, 977);
INSERT INTO `countries` VALUES (150, 'NL', 'NETHERLANDS', 'Netherlands', 'NLD', 528, 31);
INSERT INTO `countries` VALUES (151, 'AN', 'NETHERLANDS ANTILLES', 'Netherlands Antilles', 'ANT', 530, 599);
INSERT INTO `countries` VALUES (152, 'NC', 'NEW CALEDONIA', 'New Caledonia', 'NCL', 540, 687);
INSERT INTO `countries` VALUES (153, 'NZ', 'NEW ZEALAND', 'New Zealand', 'NZL', 554, 64);
INSERT INTO `countries` VALUES (154, 'NI', 'NICARAGUA', 'Nicaragua', 'NIC', 558, 505);
INSERT INTO `countries` VALUES (155, 'NE', 'NIGER', 'Niger', 'NER', 562, 227);
INSERT INTO `countries` VALUES (156, 'NG', 'NIGERIA', 'Nigeria', 'NGA', 566, 234);
INSERT INTO `countries` VALUES (157, 'NU', 'NIUE', 'Niue', 'NIU', 570, 683);
INSERT INTO `countries` VALUES (158, 'NF', 'NORFOLK ISLAND', 'Norfolk Island', 'NFK', 574, 672);
INSERT INTO `countries` VALUES (159, 'MP', 'NORTHERN MARIANA ISLANDS', 'Northern Mariana Islands', 'MNP', 580, 1670);
INSERT INTO `countries` VALUES (160, 'NO', 'NORWAY', 'Norway', 'NOR', 578, 47);
INSERT INTO `countries` VALUES (161, 'OM', 'OMAN', 'Oman', 'OMN', 512, 968);
INSERT INTO `countries` VALUES (162, 'PK', 'PAKISTAN', 'Pakistan', 'PAK', 586, 92);
INSERT INTO `countries` VALUES (163, 'PW', 'PALAU', 'Palau', 'PLW', 585, 680);
INSERT INTO `countries` VALUES (164, 'PS', 'PALESTINIAN TERRITORY, OCCUPIED', 'Palestinian Territory, Occupied', NULL, NULL, 970);
INSERT INTO `countries` VALUES (165, 'PA', 'PANAMA', 'Panama', 'PAN', 591, 507);
INSERT INTO `countries` VALUES (166, 'PG', 'PAPUA NEW GUINEA', 'Papua New Guinea', 'PNG', 598, 675);
INSERT INTO `countries` VALUES (167, 'PY', 'PARAGUAY', 'Paraguay', 'PRY', 600, 595);
INSERT INTO `countries` VALUES (168, 'PE', 'PERU', 'Peru', 'PER', 604, 51);
INSERT INTO `countries` VALUES (169, 'PH', 'PHILIPPINES', 'Philippines', 'PHL', 608, 63);
INSERT INTO `countries` VALUES (170, 'PN', 'PITCAIRN', 'Pitcairn', 'PCN', 612, 0);
INSERT INTO `countries` VALUES (171, 'PL', 'POLAND', 'Poland', 'POL', 616, 48);
INSERT INTO `countries` VALUES (172, 'PT', 'PORTUGAL', 'Portugal', 'PRT', 620, 351);
INSERT INTO `countries` VALUES (173, 'PR', 'PUERTO RICO', 'Puerto Rico', 'PRI', 630, 1787);
INSERT INTO `countries` VALUES (174, 'QA', 'QATAR', 'Qatar', 'QAT', 634, 974);
INSERT INTO `countries` VALUES (175, 'RE', 'REUNION', 'Reunion', 'REU', 638, 262);
INSERT INTO `countries` VALUES (176, 'RO', 'ROMANIA', 'Romania', 'ROM', 642, 40);
INSERT INTO `countries` VALUES (177, 'RU', 'RUSSIAN FEDERATION', 'Russian Federation', 'RUS', 643, 7);
INSERT INTO `countries` VALUES (178, 'RW', 'RWANDA', 'Rwanda', 'RWA', 646, 250);
INSERT INTO `countries` VALUES (179, 'SH', 'SAINT HELENA', 'Saint Helena', 'SHN', 654, 290);
INSERT INTO `countries` VALUES (180, 'KN', 'SAINT KITTS AND NEVIS', 'Saint Kitts and Nevis', 'KNA', 659, 1869);
INSERT INTO `countries` VALUES (181, 'LC', 'SAINT LUCIA', 'Saint Lucia', 'LCA', 662, 1758);
INSERT INTO `countries` VALUES (182, 'PM', 'SAINT PIERRE AND MIQUELON', 'Saint Pierre and Miquelon', 'SPM', 666, 508);
INSERT INTO `countries` VALUES (183, 'VC', 'SAINT VINCENT AND THE GRENADINES', 'Saint Vincent and the Grenadines', 'VCT', 670, 1784);
INSERT INTO `countries` VALUES (184, 'WS', 'SAMOA', 'Samoa', 'WSM', 882, 684);
INSERT INTO `countries` VALUES (185, 'SM', 'SAN MARINO', 'San Marino', 'SMR', 674, 378);
INSERT INTO `countries` VALUES (186, 'ST', 'SAO TOME AND PRINCIPE', 'Sao Tome and Principe', 'STP', 678, 239);
INSERT INTO `countries` VALUES (187, 'SA', 'SAUDI ARABIA', 'Saudi Arabia', 'SAU', 682, 966);
INSERT INTO `countries` VALUES (188, 'SN', 'SENEGAL', 'Senegal', 'SEN', 686, 221);
INSERT INTO `countries` VALUES (189, 'CS', 'SERBIA AND MONTENEGRO', 'Serbia and Montenegro', NULL, NULL, 381);
INSERT INTO `countries` VALUES (190, 'SC', 'SEYCHELLES', 'Seychelles', 'SYC', 690, 248);
INSERT INTO `countries` VALUES (191, 'SL', 'SIERRA LEONE', 'Sierra Leone', 'SLE', 694, 232);
INSERT INTO `countries` VALUES (192, 'SG', 'SINGAPORE', 'Singapore', 'SGP', 702, 65);
INSERT INTO `countries` VALUES (193, 'SK', 'SLOVAKIA', 'Slovakia', 'SVK', 703, 421);
INSERT INTO `countries` VALUES (194, 'SI', 'SLOVENIA', 'Slovenia', 'SVN', 705, 386);
INSERT INTO `countries` VALUES (195, 'SB', 'SOLOMON ISLANDS', 'Solomon Islands', 'SLB', 90, 677);
INSERT INTO `countries` VALUES (196, 'SO', 'SOMALIA', 'Somalia', 'SOM', 706, 252);
INSERT INTO `countries` VALUES (197, 'ZA', 'SOUTH AFRICA', 'South Africa', 'ZAF', 710, 27);
INSERT INTO `countries` VALUES (198, 'GS', 'SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS', 'South Georgia and the South Sandwich Islands', NULL, NULL, 0);
INSERT INTO `countries` VALUES (199, 'ES', 'SPAIN', 'Spain', 'ESP', 724, 34);
INSERT INTO `countries` VALUES (200, 'LK', 'SRI LANKA', 'Sri Lanka', 'LKA', 144, 94);
INSERT INTO `countries` VALUES (201, 'SD', 'SUDAN', 'Sudan', 'SDN', 736, 249);
INSERT INTO `countries` VALUES (202, 'SR', 'SURINAME', 'Suriname', 'SUR', 740, 597);
INSERT INTO `countries` VALUES (203, 'SJ', 'SVALBARD AND JAN MAYEN', 'Svalbard and Jan Mayen', 'SJM', 744, 47);
INSERT INTO `countries` VALUES (204, 'SZ', 'SWAZILAND', 'Swaziland', 'SWZ', 748, 268);
INSERT INTO `countries` VALUES (205, 'SE', 'SWEDEN', 'Sweden', 'SWE', 752, 46);
INSERT INTO `countries` VALUES (206, 'CH', 'SWITZERLAND', 'Switzerland', 'CHE', 756, 41);
INSERT INTO `countries` VALUES (207, 'SY', 'SYRIAN ARAB REPUBLIC', 'Syrian Arab Republic', 'SYR', 760, 963);
INSERT INTO `countries` VALUES (208, 'TW', 'TAIWAN, PROVINCE OF CHINA', 'Taiwan, Province of China', 'TWN', 158, 886);
INSERT INTO `countries` VALUES (209, 'TJ', 'TAJIKISTAN', 'Tajikistan', 'TJK', 762, 992);
INSERT INTO `countries` VALUES (210, 'TZ', 'TANZANIA, UNITED REPUBLIC OF', 'Tanzania, United Republic of', 'TZA', 834, 255);
INSERT INTO `countries` VALUES (211, 'TH', 'THAILAND', 'Thailand', 'THA', 764, 66);
INSERT INTO `countries` VALUES (212, 'TL', 'TIMOR-LESTE', 'Timor-Leste', NULL, NULL, 670);
INSERT INTO `countries` VALUES (213, 'TG', 'TOGO', 'Togo', 'TGO', 768, 228);
INSERT INTO `countries` VALUES (214, 'TK', 'TOKELAU', 'Tokelau', 'TKL', 772, 690);
INSERT INTO `countries` VALUES (215, 'TO', 'TONGA', 'Tonga', 'TON', 776, 676);
INSERT INTO `countries` VALUES (216, 'TT', 'TRINIDAD AND TOBAGO', 'Trinidad and Tobago', 'TTO', 780, 1868);
INSERT INTO `countries` VALUES (217, 'TN', 'TUNISIA', 'Tunisia', 'TUN', 788, 216);
INSERT INTO `countries` VALUES (218, 'TR', 'TURKEY', 'Turkey', 'TUR', 792, 90);
INSERT INTO `countries` VALUES (219, 'TM', 'TURKMENISTAN', 'Turkmenistan', 'TKM', 795, 7370);
INSERT INTO `countries` VALUES (220, 'TC', 'TURKS AND CAICOS ISLANDS', 'Turks and Caicos Islands', 'TCA', 796, 1649);
INSERT INTO `countries` VALUES (221, 'TV', 'TUVALU', 'Tuvalu', 'TUV', 798, 688);
INSERT INTO `countries` VALUES (222, 'UG', 'UGANDA', 'Uganda', 'UGA', 800, 256);
INSERT INTO `countries` VALUES (223, 'UA', 'UKRAINE', 'Ukraine', 'UKR', 804, 380);
INSERT INTO `countries` VALUES (224, 'AE', 'UNITED ARAB EMIRATES', 'United Arab Emirates', 'ARE', 784, 971);
INSERT INTO `countries` VALUES (225, 'GB', 'UNITED KINGDOM', 'United Kingdom', 'GBR', 826, 44);
INSERT INTO `countries` VALUES (226, 'US', 'UNITED STATES', 'United States', 'USA', 840, 1);
INSERT INTO `countries` VALUES (227, 'UM', 'UNITED STATES MINOR OUTLYING ISLANDS', 'United States Minor Outlying Islands', NULL, NULL, 1);
INSERT INTO `countries` VALUES (228, 'UY', 'URUGUAY', 'Uruguay', 'URY', 858, 598);
INSERT INTO `countries` VALUES (229, 'UZ', 'UZBEKISTAN', 'Uzbekistan', 'UZB', 860, 998);
INSERT INTO `countries` VALUES (230, 'VU', 'VANUATU', 'Vanuatu', 'VUT', 548, 678);
INSERT INTO `countries` VALUES (231, 'VE', 'VENEZUELA', 'Venezuela', 'VEN', 862, 58);
INSERT INTO `countries` VALUES (232, 'VN', 'VIET NAM', 'Viet Nam', 'VNM', 704, 84);
INSERT INTO `countries` VALUES (233, 'VG', 'VIRGIN ISLANDS, BRITISH', 'Virgin Islands, British', 'VGB', 92, 1284);
INSERT INTO `countries` VALUES (234, 'VI', 'VIRGIN ISLANDS, U.S.', 'Virgin Islands, U.s.', 'VIR', 850, 1340);
INSERT INTO `countries` VALUES (235, 'WF', 'WALLIS AND FUTUNA', 'Wallis and Futuna', 'WLF', 876, 681);
INSERT INTO `countries` VALUES (236, 'EH', 'WESTERN SAHARA', 'Western Sahara', 'ESH', 732, 212);
INSERT INTO `countries` VALUES (237, 'YE', 'YEMEN', 'Yemen', 'YEM', 887, 967);
INSERT INTO `countries` VALUES (238, 'ZM', 'ZAMBIA', 'Zambia', 'ZMB', 894, 260);
INSERT INTO `countries` VALUES (239, 'ZW', 'ZIMBABWE', 'Zimbabwe', 'ZWE', 716, 263);
INSERT INTO `countries` VALUES (240, 'RS', 'SERBIA', 'Serbia', 'SRB', 688, 381);
INSERT INTO `countries` VALUES (241, 'AP', 'ASIA PACIFIC REGION', 'Asia / Pacific Region', '0', 0, 0);
INSERT INTO `countries` VALUES (242, 'ME', 'MONTENEGRO', 'Montenegro', 'MNE', 499, 382);
INSERT INTO `countries` VALUES (243, 'AX', 'ALAND ISLANDS', 'Aland Islands', 'ALA', 248, 358);
INSERT INTO `countries` VALUES (244, 'BQ', 'BONAIRE, SINT EUSTATIUS AND SABA', 'Bonaire, Sint Eustatius and Saba', 'BES', 535, 599);
INSERT INTO `countries` VALUES (245, 'CW', 'CURACAO', 'Curacao', 'CUW', 531, 599);
INSERT INTO `countries` VALUES (246, 'GG', 'GUERNSEY', 'Guernsey', 'GGY', 831, 44);
INSERT INTO `countries` VALUES (247, 'IM', 'ISLE OF MAN', 'Isle of Man', 'IMN', 833, 44);
INSERT INTO `countries` VALUES (248, 'JE', 'JERSEY', 'Jersey', 'JEY', 832, 44);
INSERT INTO `countries` VALUES (249, 'XK', 'KOSOVO', 'Kosovo', '---', 0, 381);
INSERT INTO `countries` VALUES (250, 'BL', 'SAINT BARTHELEMY', 'Saint Barthelemy', 'BLM', 652, 590);
INSERT INTO `countries` VALUES (251, 'MF', 'SAINT MARTIN', 'Saint Martin', 'MAF', 663, 590);
INSERT INTO `countries` VALUES (252, 'SX', 'SINT MAARTEN', 'Sint Maarten', 'SXM', 534, 1);
INSERT INTO `countries` VALUES (253, 'SS', 'SOUTH SUDAN', 'South Sudan', 'SSD', 728, 211);

-- ----------------------------
-- Table structure for credit_note_item_images
-- ----------------------------
CREATE TABLE `credit_note_item_images`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `credit_note_item_id` int UNSIGNED NOT NULL,
  `filename` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `hashname` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `size` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `external_link` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `credit_note_item_images_credit_note_item_id_foreign`(`credit_note_item_id` ASC) USING BTREE,
  CONSTRAINT `credit_note_item_images_ibfk_1` FOREIGN KEY (`credit_note_item_id`) REFERENCES `credit_note_items` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of credit_note_item_images
-- ----------------------------

-- ----------------------------
-- Table structure for credit_note_items
-- ----------------------------
CREATE TABLE `credit_note_items`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `credit_note_id` int UNSIGNED NOT NULL,
  `item_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` enum('item','discount','tax') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'item',
  `quantity` int NOT NULL,
  `unit_price` double(8, 2) NOT NULL,
  `amount` double(8, 2) NOT NULL,
  `taxes` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `hsn_sac_code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `item_summary` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `unit_id` bigint UNSIGNED NULL DEFAULT NULL,
  `product_id` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `credit_note_items_credit_note_id_foreign`(`credit_note_id` ASC) USING BTREE,
  INDEX `credit_note_items_unit_id_foreign`(`unit_id` ASC) USING BTREE,
  INDEX `credit_note_items_product_id_foreign`(`product_id` ASC) USING BTREE,
  CONSTRAINT `credit_note_items_ibfk_1` FOREIGN KEY (`credit_note_id`) REFERENCES `credit_notes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `credit_note_items_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `credit_note_items_ibfk_3` FOREIGN KEY (`unit_id`) REFERENCES `unit_types` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of credit_note_items
-- ----------------------------

-- ----------------------------
-- Table structure for credit_notes
-- ----------------------------
CREATE TABLE `credit_notes`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `project_id` int UNSIGNED NULL DEFAULT NULL,
  `client_id` int UNSIGNED NULL DEFAULT NULL,
  `cn_number` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `invoice_id` int UNSIGNED NULL DEFAULT NULL,
  `issue_date` date NOT NULL,
  `due_date` date NOT NULL,
  `discount` double NOT NULL DEFAULT 0,
  `discount_type` enum('percent','fixed') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'percent',
  `sub_total` double(15, 2) NOT NULL,
  `total` double(15, 2) NOT NULL,
  `adjustment_amount` double(8, 2) NULL DEFAULT NULL,
  `currency_id` int UNSIGNED NULL DEFAULT NULL,
  `status` enum('closed','open') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'open',
  `recurring` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `billing_frequency` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `billing_interval` int NULL DEFAULT NULL,
  `billing_cycle` int NULL DEFAULT NULL,
  `file` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `file_original_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `calculate_tax` enum('after_discount','before_discount') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'after_discount',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `credit_notes_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `credit_notes_project_id_foreign`(`project_id` ASC) USING BTREE,
  INDEX `credit_notes_client_id_foreign`(`client_id` ASC) USING BTREE,
  INDEX `credit_notes_currency_id_foreign`(`currency_id` ASC) USING BTREE,
  INDEX `credit_notes_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `credit_notes_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `credit_notes_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `credit_notes_ibfk_2` FOREIGN KEY (`client_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `credit_notes_ibfk_3` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `credit_notes_ibfk_4` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `credit_notes_ibfk_5` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `credit_notes_ibfk_6` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of credit_notes
-- ----------------------------

-- ----------------------------
-- Table structure for currencies
-- ----------------------------
CREATE TABLE `currencies`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `currency_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `currency_symbol` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `currency_code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `exchange_rate` double NULL DEFAULT NULL,
  `is_cryptocurrency` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `usd_price` double NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `currency_position` enum('left','right','left_with_space','right_with_space') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'left',
  `no_of_decimal` int UNSIGNED NOT NULL,
  `thousand_separator` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `decimal_separator` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `currencies_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `currencies_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of currencies
-- ----------------------------
INSERT INTO `currencies` VALUES (1, 1, 'Dollars', '$', 'USD', 1, 'no', NULL, '2023-06-19 19:34:16', '2023-06-19 19:34:16', 'left', 2, ',', '.');
INSERT INTO `currencies` VALUES (2, 1, 'Pounds', '£', 'GBP', 1, 'no', NULL, '2023-06-19 19:34:16', '2023-06-19 19:34:16', 'left', 2, ',', '.');
INSERT INTO `currencies` VALUES (3, 1, 'Euros', '€', 'EUR', 1, 'no', NULL, '2023-06-19 19:34:16', '2023-06-19 19:34:16', 'left', 2, ',', '.');
INSERT INTO `currencies` VALUES (4, 1, 'Rupee', '₹', 'INR', 1, 'no', NULL, '2023-06-19 19:34:16', '2023-06-19 19:34:16', 'left', 2, ',', '.');

-- ----------------------------
-- Table structure for currency_format_settings
-- ----------------------------
CREATE TABLE `currency_format_settings`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `currency_position` enum('left','right','left_with_space','right_with_space') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'left',
  `no_of_decimal` int UNSIGNED NOT NULL,
  `thousand_separator` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `decimal_separator` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `currency_format_settings_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `currency_format_settings_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of currency_format_settings
-- ----------------------------

-- ----------------------------
-- Table structure for custom_field_groups
-- ----------------------------
CREATE TABLE `custom_field_groups`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `model` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `custom_field_groups_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `custom_field_groups_model_index`(`model` ASC) USING BTREE,
  CONSTRAINT `custom_field_groups_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of custom_field_groups
-- ----------------------------
INSERT INTO `custom_field_groups` VALUES (1, 1, 'Client', 'App\\Models\\ClientDetails');
INSERT INTO `custom_field_groups` VALUES (2, 1, 'Employee', 'App\\Models\\EmployeeDetails');
INSERT INTO `custom_field_groups` VALUES (3, 1, 'Project', 'App\\Models\\Project');
INSERT INTO `custom_field_groups` VALUES (4, 1, 'Invoice', 'App\\Models\\Invoice');
INSERT INTO `custom_field_groups` VALUES (5, 1, 'Estimate', 'App\\Models\\Estimate');
INSERT INTO `custom_field_groups` VALUES (6, 1, 'Task', 'App\\Models\\Task');
INSERT INTO `custom_field_groups` VALUES (7, 1, 'Expense', 'App\\Models\\Expense');
INSERT INTO `custom_field_groups` VALUES (8, 1, 'Lead', 'App\\Models\\Lead');
INSERT INTO `custom_field_groups` VALUES (9, 1, 'Product', 'App\\Models\\Product');
INSERT INTO `custom_field_groups` VALUES (10, 1, 'Ticket', 'App\\Models\\Ticket');
INSERT INTO `custom_field_groups` VALUES (11, 1, 'Time Log', 'App\\Models\\ProjectTimeLog');
INSERT INTO `custom_field_groups` VALUES (12, 1, 'Contract', 'App\\Models\\Contract');

-- ----------------------------
-- Table structure for custom_fields
-- ----------------------------
CREATE TABLE `custom_fields`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `custom_field_group_id` int UNSIGNED NULL DEFAULT NULL,
  `label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `required` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `values` varchar(5000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `export` tinyint(1) NULL DEFAULT 0,
  `visible` enum('true','false') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT 'false',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `custom_fields_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `custom_fields_custom_field_group_id_foreign`(`custom_field_group_id` ASC) USING BTREE,
  CONSTRAINT `custom_fields_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `custom_fields_ibfk_2` FOREIGN KEY (`custom_field_group_id`) REFERENCES `custom_field_groups` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of custom_fields
-- ----------------------------

-- ----------------------------
-- Table structure for custom_fields_data
-- ----------------------------
CREATE TABLE `custom_fields_data`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `custom_field_id` int UNSIGNED NOT NULL,
  `model_id` int UNSIGNED NOT NULL,
  `model` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `value` varchar(10000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `custom_fields_data_custom_field_id_foreign`(`custom_field_id` ASC) USING BTREE,
  INDEX `custom_fields_data_model_index`(`model` ASC) USING BTREE,
  CONSTRAINT `custom_fields_data_ibfk_1` FOREIGN KEY (`custom_field_id`) REFERENCES `custom_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of custom_fields_data
-- ----------------------------

-- ----------------------------
-- Table structure for custom_link_settings
-- ----------------------------
CREATE TABLE `custom_link_settings`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `link_title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `url` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `can_be_viewed_by` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `status` enum('active','inactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `custom_link_settings_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `custom_link_settings_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of custom_link_settings
-- ----------------------------

-- ----------------------------
-- Table structure for dashboard_widgets
-- ----------------------------
CREATE TABLE `dashboard_widgets`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `widget_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `dashboard_type` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `dashboard_widgets_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `dashboard_widgets_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 82 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of dashboard_widgets
-- ----------------------------
INSERT INTO `dashboard_widgets` VALUES (1, 1, 'total_clients', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (2, 1, 'total_employees', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (3, 1, 'total_projects', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (4, 1, 'total_unpaid_invoices', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (5, 1, 'total_hours_logged', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (6, 1, 'total_pending_tasks', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (7, 1, 'total_today_attendance', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (8, 1, 'total_unresolved_tickets', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (9, 1, 'recent_earnings', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (10, 1, 'settings_leaves', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (11, 1, 'new_tickets', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (12, 1, 'overdue_tasks', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (13, 1, 'pending_follow_up', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (14, 1, 'project_activity_timeline', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (15, 1, 'user_activity_timeline', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (16, 1, 'timelogs', 1, 'admin-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (17, 1, 'total_clients', 1, 'admin-client-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (18, 1, 'total_leads', 1, 'admin-client-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (19, 1, 'total_lead_conversions', 1, 'admin-client-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (20, 1, 'total_contracts_generated', 1, 'admin-client-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (21, 1, 'total_contracts_signed', 1, 'admin-client-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (22, 1, 'client_wise_earnings', 1, 'admin-client-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (23, 1, 'client_wise_timelogs', 1, 'admin-client-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (24, 1, 'lead_vs_status', 1, 'admin-client-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (25, 1, 'lead_vs_source', 1, 'admin-client-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (26, 1, 'latest_client', 1, 'admin-client-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (27, 1, 'recent_login_activities', 1, 'admin-client-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (28, 1, 'total_paid_invoices', 1, 'admin-finance-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (29, 1, 'total_expenses', 1, 'admin-finance-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (30, 1, 'total_earnings', 1, 'admin-finance-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (31, 1, 'total_pending_amount', 1, 'admin-finance-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (32, 1, 'invoice_overview', 1, 'admin-finance-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (33, 1, 'estimate_overview', 1, 'admin-finance-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (34, 1, 'proposal_overview', 1, 'admin-finance-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (35, 1, 'earnings_by_client', 1, 'admin-finance-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (36, 1, 'earnings_by_projects', 1, 'admin-finance-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (37, 1, 'total_unpaid_invoices', 1, 'admin-finance-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (38, 1, 'total_leaves_approved', 1, 'admin-hr-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (39, 1, 'total_new_employee', 1, 'admin-hr-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (40, 1, 'total_employee_exits', 1, 'admin-hr-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (41, 1, 'average_attendance', 1, 'admin-hr-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (42, 1, 'department_wise_employee', 1, 'admin-hr-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (43, 1, 'designation_wise_employee', 1, 'admin-hr-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (44, 1, 'gender_wise_employee', 1, 'admin-hr-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (45, 1, 'role_wise_employee', 1, 'admin-hr-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (46, 1, 'leaves_taken', 1, 'admin-hr-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (47, 1, 'late_attendance_mark', 1, 'admin-hr-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (48, 1, 'headcount', 1, 'admin-hr-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (49, 1, 'joining_vs_attrition', 1, 'admin-hr-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (50, 1, 'birthday', 1, 'admin-hr-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (51, 1, 'total_today_attendance', 1, 'admin-hr-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (52, 1, 'total_project', 1, 'admin-project-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (53, 1, 'total_hours_logged', 1, 'admin-project-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (54, 1, 'total_overdue_project', 1, 'admin-project-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (55, 1, 'status_wise_project', 1, 'admin-project-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (56, 1, 'pending_milestone', 1, 'admin-project-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (57, 1, 'total_tickets', 1, 'admin-ticket-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (58, 1, 'total_unassigned_ticket', 1, 'admin-ticket-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (59, 1, 'type_wise_ticket', 1, 'admin-ticket-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (60, 1, 'status_wise_ticket', 1, 'admin-ticket-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (61, 1, 'channel_wise_ticket', 1, 'admin-ticket-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (62, 1, 'new_tickets', 1, 'admin-ticket-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (63, 1, 'profile', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (64, 1, 'shift_schedule', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (65, 1, 'birthday', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (66, 1, 'notices', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (67, 1, 'tasks', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (68, 1, 'projects', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (69, 1, 'my_task', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (70, 1, 'my_calender', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (71, 1, 'week_timelog', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (72, 1, 'leave', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (73, 1, 'lead', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (74, 1, 'work_from_home', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (75, 1, 'appreciation', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (76, 1, 'work_anniversary', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (77, 1, 'ticket', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (78, 1, 'notice_period_duration', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (79, 1, 'probation_date', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (80, 1, 'contract_date', 1, 'private-dashboard', NULL, NULL);
INSERT INTO `dashboard_widgets` VALUES (81, 1, 'internship_date', 1, 'private-dashboard', NULL, NULL);

-- ----------------------------
-- Table structure for database_backup_cron_settings
-- ----------------------------
CREATE TABLE `database_backup_cron_settings`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `status` enum('active','inactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'inactive',
  `hour_of_day` time NULL DEFAULT NULL,
  `backup_after_days` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `delete_backup_after_days` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of database_backup_cron_settings
-- ----------------------------
INSERT INTO `database_backup_cron_settings` VALUES (1, 'inactive', '00:00:00', '0', '0');

-- ----------------------------
-- Table structure for database_backups
-- ----------------------------
CREATE TABLE `database_backups`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `filename` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `size` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` datetime NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of database_backups
-- ----------------------------

-- ----------------------------
-- Table structure for designations
-- ----------------------------
CREATE TABLE `designations`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `parent_id` int UNSIGNED NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `designations_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `designations_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `designations_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `designations_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `designations_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `designations_ibfk_3` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of designations
-- ----------------------------
INSERT INTO `designations` VALUES (1, 1, 'Test', NULL, NULL, NULL, '2023-06-22 17:22:54', '2023-06-22 17:22:54');

-- ----------------------------
-- Table structure for discussion_categories
-- ----------------------------
CREATE TABLE `discussion_categories`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `order` int NOT NULL DEFAULT 1,
  `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `color` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `discussion_categories_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `discussion_categories_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of discussion_categories
-- ----------------------------
INSERT INTO `discussion_categories` VALUES (1, 1, 1, 'General', '#3498DB', '2023-06-19 19:34:17', '2023-06-19 19:34:17');

-- ----------------------------
-- Table structure for discussion_files
-- ----------------------------
CREATE TABLE `discussion_files`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `discussion_id` int UNSIGNED NULL DEFAULT NULL,
  `discussion_reply_id` int UNSIGNED NULL DEFAULT NULL,
  `filename` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `google_url` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `hashname` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `size` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `dropbox_link` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `external_link_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `discussion_files_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `discussion_files_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `discussion_files_discussion_id_foreign`(`discussion_id` ASC) USING BTREE,
  INDEX `discussion_files_discussion_reply_id_foreign`(`discussion_reply_id` ASC) USING BTREE,
  CONSTRAINT `discussion_files_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `discussion_files_ibfk_2` FOREIGN KEY (`discussion_id`) REFERENCES `discussions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `discussion_files_ibfk_3` FOREIGN KEY (`discussion_reply_id`) REFERENCES `discussion_replies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `discussion_files_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of discussion_files
-- ----------------------------

-- ----------------------------
-- Table structure for discussion_replies
-- ----------------------------
CREATE TABLE `discussion_replies`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `discussion_id` int UNSIGNED NOT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `body` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `discussion_replies_discussion_id_foreign`(`discussion_id` ASC) USING BTREE,
  INDEX `discussion_replies_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `discussion_replies_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `discussion_replies_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `discussion_replies_ibfk_2` FOREIGN KEY (`discussion_id`) REFERENCES `discussions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `discussion_replies_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of discussion_replies
-- ----------------------------

-- ----------------------------
-- Table structure for discussions
-- ----------------------------
CREATE TABLE `discussions`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `discussion_category_id` int UNSIGNED NULL DEFAULT 1,
  `project_id` int UNSIGNED NULL DEFAULT NULL,
  `title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `color` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '#232629',
  `user_id` int UNSIGNED NOT NULL,
  `pinned` tinyint(1) NOT NULL DEFAULT 0,
  `closed` tinyint(1) NOT NULL DEFAULT 0,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `last_reply_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `best_answer_id` int UNSIGNED NULL DEFAULT NULL,
  `last_reply_by_id` int UNSIGNED NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `discussions_discussion_category_id_foreign`(`discussion_category_id` ASC) USING BTREE,
  INDEX `discussions_project_id_foreign`(`project_id` ASC) USING BTREE,
  INDEX `discussions_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `discussions_best_answer_id_foreign`(`best_answer_id` ASC) USING BTREE,
  INDEX `discussions_last_reply_by_id_foreign`(`last_reply_by_id` ASC) USING BTREE,
  INDEX `discussions_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `discussions_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  INDEX `discussions_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `discussions_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `discussions_ibfk_2` FOREIGN KEY (`best_answer_id`) REFERENCES `discussion_replies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `discussions_ibfk_3` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `discussions_ibfk_4` FOREIGN KEY (`discussion_category_id`) REFERENCES `discussion_categories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `discussions_ibfk_5` FOREIGN KEY (`last_reply_by_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `discussions_ibfk_6` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `discussions_ibfk_7` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `discussions_ibfk_8` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of discussions
-- ----------------------------

-- ----------------------------
-- Table structure for email_notification_settings
-- ----------------------------
CREATE TABLE `email_notification_settings`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `slug` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `setting_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `send_email` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `send_slack` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `send_push` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `email_notification_settings_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `email_notification_settings_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 28 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of email_notification_settings
-- ----------------------------
INSERT INTO `email_notification_settings` VALUES (1, 1, 'new-expenseadded-by-admin', 'New Expense/Added by Admin', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (2, 1, 'new-expenseadded-by-member', 'New Expense/Added by Member', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (3, 1, 'expense-status-changed', 'Expense Status Changed', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (4, 1, 'new-support-ticket-request', 'New Support Ticket Request', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (5, 1, 'new-leave-application', 'New Leave Application', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (6, 1, 'task-completed', 'Task Completed', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (7, 1, 'invoice-createupdate-notification', 'Invoice Create/Update Notification', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (8, 1, 'discussion-reply', 'Discussion Reply', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (9, 1, 'new-product-purchase-request', 'New Product Purchase Request', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (10, 1, 'lead-notification', 'Lead notification', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (11, 1, 'order-createupdate-notification', 'Order Create/Update Notification', 'no', 'no', 'no', NULL, NULL);
INSERT INTO `email_notification_settings` VALUES (12, 1, 'user-join-via-invitation', 'User Join via Invitation', 'no', 'no', 'no', NULL, NULL);
INSERT INTO `email_notification_settings` VALUES (13, 1, 'follow-up-reminder', 'Follow Up Reminder', 'no', 'no', 'no', NULL, NULL);
INSERT INTO `email_notification_settings` VALUES (14, 1, 'user-registrationadded-by-admin', 'User Registration/Added by Admin', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (15, 1, 'employee-assign-to-project', 'Employee Assign to Project', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (16, 1, 'new-notice-published', 'New Notice Published', 'no', 'no', 'no', NULL, NULL);
INSERT INTO `email_notification_settings` VALUES (17, 1, 'user-assign-to-task', 'User Assign to Task', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (18, 1, 'birthday-notification', 'Birthday notification', 'yes', 'yes', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (19, 1, 'payment-notification', 'Payment Notification', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (20, 1, 'appreciation-notification', 'Employee Appreciation', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (21, 1, 'clock-in-notification', 'Clock In Notification', 'no', 'no', 'no', NULL, NULL);
INSERT INTO `email_notification_settings` VALUES (22, 1, 'holiday-notification', 'Holiday Notification', 'no', 'no', 'no', NULL, NULL);
INSERT INTO `email_notification_settings` VALUES (23, 1, 'estimate-notification', 'Estimate Notification', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (24, 1, 'event-notification', 'Event Notification', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (25, 1, 'message-notification', 'Message Notification', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (26, 1, 'project-mention-notification', 'Project Mention Notification', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');
INSERT INTO `email_notification_settings` VALUES (27, 1, 'task-mention-notification', 'Task Mention', 'yes', 'no', 'no', NULL, '2023-06-22 17:29:48');

-- ----------------------------
-- Table structure for emergency_contacts
-- ----------------------------
CREATE TABLE `emergency_contacts`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `email` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `mobile` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `relation` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `address` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `emergency_contacts_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `emergency_contacts_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `emergency_contacts_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `emergency_contacts_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `emergency_contacts_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `emergency_contacts_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `emergency_contacts_ibfk_3` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `emergency_contacts_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of emergency_contacts
-- ----------------------------

-- ----------------------------
-- Table structure for employee_details
-- ----------------------------
CREATE TABLE `employee_details`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `employee_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `address` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `hourly_rate` double NULL DEFAULT NULL,
  `slack_username` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `department_id` int UNSIGNED NULL DEFAULT NULL,
  `designation_id` bigint UNSIGNED NULL DEFAULT NULL,
  `joining_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_date` date NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `attendance_reminder` date NULL DEFAULT NULL,
  `date_of_birth` date NULL DEFAULT NULL,
  `calendar_view` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `about_me` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `reporting_to` int UNSIGNED NULL DEFAULT NULL,
  `contract_end_date` date NULL DEFAULT NULL,
  `internship_end_date` date NULL DEFAULT NULL,
  `employment_type` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `marriage_anniversary_date` date NULL DEFAULT NULL,
  `marital_status` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT 'unmarried',
  `notice_period_end_date` date NULL DEFAULT NULL,
  `notice_period_start_date` date NULL DEFAULT NULL,
  `probation_end_date` date NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `employee_details_employee_id_company_id_unique`(`employee_id` ASC, `company_id` ASC) USING BTREE,
  UNIQUE INDEX `employee_details_slack_username_company_id_unique`(`slack_username` ASC, `company_id` ASC) USING BTREE,
  INDEX `employee_details_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `employee_details_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `employee_details_department_id_foreign`(`department_id` ASC) USING BTREE,
  INDEX `employee_details_designation_id_foreign`(`designation_id` ASC) USING BTREE,
  INDEX `employee_details_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `employee_details_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  INDEX `employee_details_reporting_to_foreign`(`reporting_to` ASC) USING BTREE,
  CONSTRAINT `employee_details_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `employee_details_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `employee_details_ibfk_3` FOREIGN KEY (`department_id`) REFERENCES `teams` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `employee_details_ibfk_4` FOREIGN KEY (`designation_id`) REFERENCES `designations` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `employee_details_ibfk_5` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `employee_details_ibfk_6` FOREIGN KEY (`reporting_to`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `employee_details_ibfk_7` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of employee_details
-- ----------------------------
INSERT INTO `employee_details` VALUES (1, 1, 1, '1', NULL, NULL, NULL, NULL, NULL, '2023-06-20 01:04:57', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'unmarried', NULL, NULL, NULL, '2023-06-19 19:34:57', '2023-06-19 19:34:57');
INSERT INTO `employee_details` VALUES (2, 1, 8, '2', NULL, NULL, NULL, 1, 1, '2023-06-22 00:00:00', NULL, 1, 8, NULL, NULL, 'task,events,holiday,tickets,leaves', NULL, NULL, NULL, NULL, NULL, NULL, 'unmarried', NULL, NULL, NULL, '2023-06-22 17:31:20', '2023-06-28 17:11:11');
INSERT INTO `employee_details` VALUES (3, 1, 2, '3', NULL, NULL, NULL, 1, 1, '2023-06-22 23:10:37', NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'unmarried', NULL, NULL, NULL, NULL, '2023-06-27 12:45:00');

-- ----------------------------
-- Table structure for employee_docs
-- ----------------------------
CREATE TABLE `employee_docs`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `filename` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `hashname` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `size` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `employee_docs_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `employee_docs_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `employee_docs_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `employee_docs_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `employee_docs_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `employee_docs_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `employee_docs_ibfk_3` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `employee_docs_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of employee_docs
-- ----------------------------

-- ----------------------------
-- Table structure for employee_leave_quotas
-- ----------------------------
CREATE TABLE `employee_leave_quotas`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` int UNSIGNED NOT NULL,
  `leave_type_id` int UNSIGNED NOT NULL,
  `no_of_leaves` double NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `employee_leave_quotas_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `employee_leave_quotas_leave_type_id_foreign`(`leave_type_id` ASC) USING BTREE,
  CONSTRAINT `employee_leave_quotas_ibfk_1` FOREIGN KEY (`leave_type_id`) REFERENCES `leave_types` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `employee_leave_quotas_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of employee_leave_quotas
-- ----------------------------
INSERT INTO `employee_leave_quotas` VALUES (1, 1, 1, 5, '2023-06-19 19:34:57', '2023-06-19 19:34:57');
INSERT INTO `employee_leave_quotas` VALUES (2, 1, 2, 5, '2023-06-19 19:34:57', '2023-06-19 19:34:57');
INSERT INTO `employee_leave_quotas` VALUES (3, 1, 3, 5, '2023-06-19 19:34:57', '2023-06-19 19:34:57');
INSERT INTO `employee_leave_quotas` VALUES (4, 8, 1, 5, '2023-06-22 17:31:20', '2023-06-22 17:31:20');
INSERT INTO `employee_leave_quotas` VALUES (5, 8, 2, 5, '2023-06-22 17:31:20', '2023-06-22 17:31:20');
INSERT INTO `employee_leave_quotas` VALUES (6, 8, 3, 5, '2023-06-22 17:31:20', '2023-06-22 17:31:20');

-- ----------------------------
-- Table structure for employee_shift_change_requests
-- ----------------------------
CREATE TABLE `employee_shift_change_requests`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `shift_schedule_id` bigint UNSIGNED NOT NULL,
  `employee_shift_id` bigint UNSIGNED NOT NULL,
  `status` enum('waiting','accepted','rejected') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'waiting',
  `reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `employee_shift_change_requests_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `employee_shift_change_requests_shift_schedule_id_foreign`(`shift_schedule_id` ASC) USING BTREE,
  INDEX `employee_shift_change_requests_employee_shift_id_foreign`(`employee_shift_id` ASC) USING BTREE,
  CONSTRAINT `employee_shift_change_requests_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `employee_shift_change_requests_ibfk_2` FOREIGN KEY (`employee_shift_id`) REFERENCES `employee_shifts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `employee_shift_change_requests_ibfk_3` FOREIGN KEY (`shift_schedule_id`) REFERENCES `employee_shift_schedules` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of employee_shift_change_requests
-- ----------------------------

-- ----------------------------
-- Table structure for employee_shift_schedules
-- ----------------------------
CREATE TABLE `employee_shift_schedules`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` int UNSIGNED NOT NULL,
  `date` date NOT NULL,
  `employee_shift_id` bigint UNSIGNED NOT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `shift_start_time` datetime NULL DEFAULT NULL,
  `shift_end_time` datetime NULL DEFAULT NULL,
  `remarks` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `file` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `employee_shift_schedules_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `employee_shift_schedules_date_index`(`date` ASC) USING BTREE,
  INDEX `employee_shift_schedules_employee_shift_id_foreign`(`employee_shift_id` ASC) USING BTREE,
  INDEX `employee_shift_schedules_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `employee_shift_schedules_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `employee_shift_schedules_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `employee_shift_schedules_ibfk_2` FOREIGN KEY (`employee_shift_id`) REFERENCES `employee_shifts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `employee_shift_schedules_ibfk_3` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `employee_shift_schedules_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of employee_shift_schedules
-- ----------------------------

-- ----------------------------
-- Table structure for employee_shifts
-- ----------------------------
CREATE TABLE `employee_shifts`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `shift_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `shift_short_code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `color` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `office_start_time` time NOT NULL,
  `office_end_time` time NOT NULL,
  `halfday_mark_time` time NULL DEFAULT NULL,
  `late_mark_duration` tinyint NOT NULL,
  `clockin_in_day` tinyint NOT NULL,
  `office_open_days` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `early_clock_in` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `employee_shifts_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `employee_shifts_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of employee_shifts
-- ----------------------------
INSERT INTO `employee_shifts` VALUES (1, 1, 'Day Off', 'DO', '#E8EEF3', '00:00:00', '00:00:00', NULL, 0, 0, '', '2023-06-19 19:34:17', '2023-06-19 19:34:17', NULL);
INSERT INTO `employee_shifts` VALUES (2, 1, 'General Shift', 'GS', '#99C7F1', '09:00:00', '18:00:00', NULL, 20, 2, '[\"1\",\"2\",\"3\",\"4\",\"5\"]', '2023-06-19 19:34:17', '2023-06-19 19:34:17', NULL);

-- ----------------------------
-- Table structure for employee_skills
-- ----------------------------
CREATE TABLE `employee_skills`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `skill_id` int UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `employee_skills_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `employee_skills_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `employee_skills_skill_id_foreign`(`skill_id` ASC) USING BTREE,
  CONSTRAINT `employee_skills_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `employee_skills_ibfk_2` FOREIGN KEY (`skill_id`) REFERENCES `skills` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `employee_skills_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of employee_skills
-- ----------------------------

-- ----------------------------
-- Table structure for employee_teams
-- ----------------------------
CREATE TABLE `employee_teams`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `team_id` int UNSIGNED NOT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `employee_teams_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `employee_teams_team_id_foreign`(`team_id` ASC) USING BTREE,
  INDEX `employee_teams_user_id_foreign`(`user_id` ASC) USING BTREE,
  CONSTRAINT `employee_teams_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `employee_teams_ibfk_2` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `employee_teams_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of employee_teams
-- ----------------------------

-- ----------------------------
-- Table structure for estimate_item_images
-- ----------------------------
CREATE TABLE `estimate_item_images`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `estimate_item_id` int UNSIGNED NOT NULL,
  `filename` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `hashname` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `size` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `external_link` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `estimate_item_images_estimate_item_id_foreign`(`estimate_item_id` ASC) USING BTREE,
  CONSTRAINT `estimate_item_images_ibfk_1` FOREIGN KEY (`estimate_item_id`) REFERENCES `estimate_items` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of estimate_item_images
-- ----------------------------

-- ----------------------------
-- Table structure for estimate_items
-- ----------------------------
CREATE TABLE `estimate_items`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `estimate_id` int UNSIGNED NOT NULL,
  `item_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `item_summary` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `type` enum('item','discount','tax') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'item',
  `quantity` double(16, 2) NOT NULL,
  `unit_price` double(16, 2) NOT NULL,
  `amount` double(16, 2) NOT NULL,
  `taxes` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `hsn_sac_code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `unit_id` bigint UNSIGNED NULL DEFAULT NULL,
  `product_id` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `estimate_items_estimate_id_foreign`(`estimate_id` ASC) USING BTREE,
  INDEX `estimate_items_unit_id_foreign`(`unit_id` ASC) USING BTREE,
  INDEX `estimate_items_product_id_foreign`(`product_id` ASC) USING BTREE,
  CONSTRAINT `estimate_items_ibfk_1` FOREIGN KEY (`estimate_id`) REFERENCES `estimates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `estimate_items_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `estimate_items_ibfk_3` FOREIGN KEY (`unit_id`) REFERENCES `unit_types` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of estimate_items
-- ----------------------------

-- ----------------------------
-- Table structure for estimate_template_item_images
-- ----------------------------
CREATE TABLE `estimate_template_item_images`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `estimate_template_item_id` int UNSIGNED NOT NULL,
  `filename` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `hashname` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `size` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `external_link` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `estimate_template_item_images_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `estimate_template_item_images_estimate_template_item_id_foreign`(`estimate_template_item_id` ASC) USING BTREE,
  CONSTRAINT `estimate_template_item_images_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `estimate_template_item_images_ibfk_2` FOREIGN KEY (`estimate_template_item_id`) REFERENCES `estimate_template_items` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of estimate_template_item_images
-- ----------------------------

-- ----------------------------
-- Table structure for estimate_template_items
-- ----------------------------
CREATE TABLE `estimate_template_items`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `estimate_template_id` bigint UNSIGNED NOT NULL,
  `hsn_sac_code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `item_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` enum('item','discount','tax') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'item',
  `quantity` tinyint NOT NULL,
  `unit_price` double NOT NULL,
  `amount` double NOT NULL,
  `item_summary` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `taxes` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `unit_id` bigint UNSIGNED NULL DEFAULT NULL,
  `product_id` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `estimate_template_items_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `estimate_template_items_estimate_template_id_foreign`(`estimate_template_id` ASC) USING BTREE,
  INDEX `estimate_template_items_unit_id_foreign`(`unit_id` ASC) USING BTREE,
  INDEX `estimate_template_items_product_id_foreign`(`product_id` ASC) USING BTREE,
  CONSTRAINT `estimate_template_items_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `estimate_template_items_ibfk_2` FOREIGN KEY (`estimate_template_id`) REFERENCES `estimate_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `estimate_template_items_ibfk_3` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `estimate_template_items_ibfk_4` FOREIGN KEY (`unit_id`) REFERENCES `unit_types` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of estimate_template_items
-- ----------------------------

-- ----------------------------
-- Table structure for estimate_templates
-- ----------------------------
CREATE TABLE `estimate_templates`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `sub_total` double NOT NULL,
  `total` double NOT NULL,
  `currency_id` int UNSIGNED NULL DEFAULT NULL,
  `discount_type` enum('percent','fixed') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `discount` double NOT NULL,
  `invoice_convert` tinyint(1) NOT NULL DEFAULT 0,
  `status` enum('declined','accepted','waiting') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'waiting',
  `note` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `description` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `calculate_tax` enum('after_discount','before_discount') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'after_discount',
  `client_comment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `signature_approval` tinyint(1) NOT NULL DEFAULT 1,
  `hash` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `estimate_templates_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `estimate_templates_currency_id_foreign`(`currency_id` ASC) USING BTREE,
  INDEX `estimate_templates_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `estimate_templates_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `estimate_templates_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `estimate_templates_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `estimate_templates_ibfk_3` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `estimate_templates_ibfk_4` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of estimate_templates
-- ----------------------------

-- ----------------------------
-- Table structure for estimates
-- ----------------------------
CREATE TABLE `estimates`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `client_id` int UNSIGNED NOT NULL,
  `estimate_number` bigint NULL DEFAULT NULL,
  `valid_till` date NOT NULL,
  `sub_total` double(16, 2) NOT NULL,
  `discount` double NOT NULL DEFAULT 0,
  `discount_type` enum('percent','fixed') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'percent',
  `total` double(16, 2) NOT NULL,
  `currency_id` int UNSIGNED NULL DEFAULT NULL,
  `status` enum('declined','accepted','waiting','sent','draft','canceled') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'waiting',
  `note` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `description` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `send_status` tinyint(1) NOT NULL DEFAULT 1,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `hash` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `calculate_tax` enum('after_discount','before_discount') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'after_discount',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `last_viewed` timestamp NULL DEFAULT NULL,
  `ip_address` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `estimates_estimate_number_company_id_unique`(`estimate_number` ASC, `company_id` ASC) USING BTREE,
  INDEX `estimates_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `estimates_client_id_foreign`(`client_id` ASC) USING BTREE,
  INDEX `estimates_currency_id_foreign`(`currency_id` ASC) USING BTREE,
  INDEX `estimates_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `estimates_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `estimates_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `estimates_ibfk_2` FOREIGN KEY (`client_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `estimates_ibfk_3` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `estimates_ibfk_4` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `estimates_ibfk_5` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of estimates
-- ----------------------------

-- ----------------------------
-- Table structure for event_attendees
-- ----------------------------
CREATE TABLE `event_attendees`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `event_id` int UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `event_attendees_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `event_attendees_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `event_attendees_event_id_foreign`(`event_id` ASC) USING BTREE,
  CONSTRAINT `event_attendees_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `event_attendees_ibfk_2` FOREIGN KEY (`event_id`) REFERENCES `events` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `event_attendees_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of event_attendees
-- ----------------------------

-- ----------------------------
-- Table structure for event_files
-- ----------------------------
CREATE TABLE `event_files`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `event_id` int UNSIGNED NOT NULL,
  `filename` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `hashname` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `size` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `event_files_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `event_files_event_id_foreign`(`event_id` ASC) USING BTREE,
  INDEX `event_files_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `event_files_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `event_files_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `event_files_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `event_files_ibfk_3` FOREIGN KEY (`event_id`) REFERENCES `events` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `event_files_ibfk_4` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of event_files
-- ----------------------------

-- ----------------------------
-- Table structure for events
-- ----------------------------
CREATE TABLE `events`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `event_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `label_color` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `where` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `start_date_time` datetime NOT NULL,
  `end_date_time` datetime NOT NULL,
  `repeat` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `repeat_every` int NULL DEFAULT NULL,
  `repeat_cycles` int NULL DEFAULT NULL,
  `repeat_type` enum('day','week','month','year') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'day',
  `send_reminder` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `remind_time` int NULL DEFAULT NULL,
  `remind_type` enum('day','hour','minute') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'day',
  `event_link` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `event_id` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `events_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `events_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `events_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `events_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `events_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `events_ibfk_3` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of events
-- ----------------------------

-- ----------------------------
-- Table structure for expenses
-- ----------------------------
CREATE TABLE `expenses`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `item_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `purchase_date` date NOT NULL,
  `purchase_from` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `price` double(16, 2) NOT NULL,
  `currency_id` int UNSIGNED NOT NULL,
  `default_currency_id` int UNSIGNED NULL DEFAULT NULL,
  `exchange_rate` double NULL DEFAULT NULL,
  `project_id` int UNSIGNED NULL DEFAULT NULL,
  `bill` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `status` enum('pending','approved','rejected') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `can_claim` tinyint(1) NOT NULL DEFAULT 1,
  `category_id` bigint UNSIGNED NULL DEFAULT NULL,
  `expenses_recurring_id` bigint UNSIGNED NULL DEFAULT NULL,
  `created_by` int UNSIGNED NULL DEFAULT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `approver_id` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `bank_account_id` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `expenses_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `expenses_currency_id_foreign`(`currency_id` ASC) USING BTREE,
  INDEX `expenses_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `expenses_category_id_foreign`(`category_id` ASC) USING BTREE,
  INDEX `expenses_expenses_recurring_id_foreign`(`expenses_recurring_id` ASC) USING BTREE,
  INDEX `expenses_created_by_foreign`(`created_by` ASC) USING BTREE,
  INDEX `expenses_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `expenses_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  INDEX `expenses_approver_id_foreign`(`approver_id` ASC) USING BTREE,
  INDEX `expenses_bank_account_id_foreign`(`bank_account_id` ASC) USING BTREE,
  INDEX `expenses_default_currency_id_foreign`(`default_currency_id` ASC) USING BTREE,
  CONSTRAINT `expenses_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `expenses_ibfk_10` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `expenses_ibfk_11` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `expenses_ibfk_2` FOREIGN KEY (`approver_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `expenses_ibfk_3` FOREIGN KEY (`bank_account_id`) REFERENCES `bank_accounts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `expenses_ibfk_4` FOREIGN KEY (`category_id`) REFERENCES `expenses_category` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `expenses_ibfk_5` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `expenses_ibfk_6` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  CONSTRAINT `expenses_ibfk_7` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `expenses_ibfk_8` FOREIGN KEY (`default_currency_id`) REFERENCES `currencies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `expenses_ibfk_9` FOREIGN KEY (`expenses_recurring_id`) REFERENCES `expenses_recurring` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of expenses
-- ----------------------------

-- ----------------------------
-- Table structure for expenses_category
-- ----------------------------
CREATE TABLE `expenses_category`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `category_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `expenses_category_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `expenses_category_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `expenses_category_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `expenses_category_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `expenses_category_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `expenses_category_ibfk_3` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of expenses_category
-- ----------------------------

-- ----------------------------
-- Table structure for expenses_category_roles
-- ----------------------------
CREATE TABLE `expenses_category_roles`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `expenses_category_id` bigint UNSIGNED NULL DEFAULT NULL,
  `role_id` int UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `expenses_category_roles_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `expenses_category_roles_expenses_category_id_foreign`(`expenses_category_id` ASC) USING BTREE,
  INDEX `expenses_category_roles_role_id_foreign`(`role_id` ASC) USING BTREE,
  CONSTRAINT `expenses_category_roles_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `expenses_category_roles_ibfk_2` FOREIGN KEY (`expenses_category_id`) REFERENCES `expenses_category` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `expenses_category_roles_ibfk_3` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of expenses_category_roles
-- ----------------------------

-- ----------------------------
-- Table structure for expenses_recurring
-- ----------------------------
CREATE TABLE `expenses_recurring`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `category_id` bigint UNSIGNED NULL DEFAULT NULL,
  `currency_id` int UNSIGNED NULL DEFAULT NULL,
  `project_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NULL DEFAULT NULL,
  `created_by` int UNSIGNED NULL DEFAULT NULL,
  `item_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `day_of_month` int NULL DEFAULT 1,
  `day_of_week` int NULL DEFAULT 1,
  `payment_method` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `rotation` enum('monthly','weekly','bi-weekly','quarterly','half-yearly','annually','daily') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `billing_cycle` int NULL DEFAULT NULL,
  `issue_date` date NOT NULL,
  `next_expense_date` date NULL DEFAULT NULL,
  `unlimited_recurring` tinyint(1) NOT NULL DEFAULT 0,
  `price` double NOT NULL,
  `bill` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `status` enum('active','inactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active',
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `purchase_from` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `immediate_expense` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `bank_account_id` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `expenses_recurring_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `expenses_recurring_category_id_foreign`(`category_id` ASC) USING BTREE,
  INDEX `expenses_recurring_currency_id_foreign`(`currency_id` ASC) USING BTREE,
  INDEX `expenses_recurring_project_id_foreign`(`project_id` ASC) USING BTREE,
  INDEX `expenses_recurring_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `expenses_recurring_created_by_foreign`(`created_by` ASC) USING BTREE,
  INDEX `expenses_recurring_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `expenses_recurring_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  INDEX `expenses_recurring_bank_account_id_foreign`(`bank_account_id` ASC) USING BTREE,
  CONSTRAINT `expenses_recurring_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `expenses_recurring_ibfk_2` FOREIGN KEY (`bank_account_id`) REFERENCES `bank_accounts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `expenses_recurring_ibfk_3` FOREIGN KEY (`category_id`) REFERENCES `expenses_category` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `expenses_recurring_ibfk_4` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `expenses_recurring_ibfk_5` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  CONSTRAINT `expenses_recurring_ibfk_6` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `expenses_recurring_ibfk_7` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `expenses_recurring_ibfk_8` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `expenses_recurring_ibfk_9` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of expenses_recurring
-- ----------------------------

-- ----------------------------
-- Table structure for failed_jobs
-- ----------------------------
CREATE TABLE `failed_jobs`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `uuid` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `connection` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `queue` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `exception` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `failed_jobs_uuid_unique`(`uuid` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of failed_jobs
-- ----------------------------

-- ----------------------------
-- Table structure for file_storage
-- ----------------------------
CREATE TABLE `file_storage`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `path` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `filename` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `size` int UNSIGNED NOT NULL,
  `storage_location` enum('local','aws_s3','digitalocean','wasabi','minio') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'local',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `file_storage_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `file_storage_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of file_storage
-- ----------------------------
INSERT INTO `file_storage` VALUES (3, 1, 'favicon', '089b38c0544781917d6d140427c6e464.png', 'image/png', 1176, 'local', '2023-06-27 10:30:46', '2023-06-27 10:30:46');
INSERT INTO `file_storage` VALUES (7, 1, 'app-logo', '3ff2aaa1a17e779dfe7aa22c01d965a5.png', 'image/png', 88835, 'local', '2023-06-27 11:29:47', '2023-06-27 11:29:47');
INSERT INTO `file_storage` VALUES (8, 1, 'app-logo', '713d45ffca831468c17844a797f07f08.png', 'image/png', 96643, 'local', '2023-06-27 12:16:14', '2023-06-27 12:16:14');
INSERT INTO `file_storage` VALUES (9, 1, 'app-logo', '33f0c9c2178178fd820e9e0f7b19e5f1.png', 'image/png', 96646, 'local', '2023-06-27 12:16:14', '2023-06-27 12:16:14');
INSERT INTO `file_storage` VALUES (10, 1, 'favicon', 'dc9f613b444dded14ae8811ed3705883.png', 'image/png', 1176, 'local', '2023-06-27 12:16:14', '2023-06-27 12:16:14');
INSERT INTO `file_storage` VALUES (12, 1, 'avatar', 'feb670eb36238e06fb6cf5ee83bb1563.png', 'image/png', 843477, 'local', '2023-06-28 07:46:30', '2023-06-28 07:46:30');
INSERT INTO `file_storage` VALUES (14, 1, 'avatar', '7d4fa91b28705ac7994f10b4e8430dd1.png', 'image/png', 33238, 'local', '2023-06-28 17:11:19', '2023-06-28 17:11:19');

-- ----------------------------
-- Table structure for file_storage_settings
-- ----------------------------
CREATE TABLE `file_storage_settings`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `filesystem` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `auth_keys` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `status` enum('enabled','disabled') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'disabled',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of file_storage_settings
-- ----------------------------
INSERT INTO `file_storage_settings` VALUES (1, 'local', NULL, 'enabled', '2023-06-19 19:34:13', '2023-06-19 19:34:13');

-- ----------------------------
-- Table structure for flags
-- ----------------------------
CREATE TABLE `flags`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `capital` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `continent` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 267 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of flags
-- ----------------------------
INSERT INTO `flags` VALUES (1, 'Kabul', 'af', 'Asia', 'Afghanistan');
INSERT INTO `flags` VALUES (2, 'Mariehamn', 'ax', 'Europe', 'Aland Islands');
INSERT INTO `flags` VALUES (3, 'Tirana', 'al', 'Europe', 'Albania');
INSERT INTO `flags` VALUES (4, 'Algiers', 'dz', 'Africa', 'Algeria');
INSERT INTO `flags` VALUES (5, 'Pago Pago', 'as', 'Oceania', 'American Samoa');
INSERT INTO `flags` VALUES (6, 'Andorra la Vella', 'ad', 'Europe', 'Andorra');
INSERT INTO `flags` VALUES (7, 'Luanda', 'ao', 'Africa', 'Angola');
INSERT INTO `flags` VALUES (8, 'The Valley', 'ai', 'North America', 'Anguilla');
INSERT INTO `flags` VALUES (9, '', 'aq', '', 'Antarctica');
INSERT INTO `flags` VALUES (10, 'St. John\'s', 'ag', 'North America', 'Antigua and Barbuda');
INSERT INTO `flags` VALUES (11, 'Buenos Aires', 'ar', 'South America', 'Argentina');
INSERT INTO `flags` VALUES (12, 'Yerevan', 'am', 'Asia', 'Armenia');
INSERT INTO `flags` VALUES (13, 'Oranjestad', 'aw', 'South America', 'Aruba');
INSERT INTO `flags` VALUES (14, 'Georgetown', 'ac', 'Africa', 'Ascension Island');
INSERT INTO `flags` VALUES (15, 'Canberra', 'au', 'Oceania', 'Australia');
INSERT INTO `flags` VALUES (16, 'Vienna', 'at', 'Europe', 'Austria');
INSERT INTO `flags` VALUES (17, 'Baku', 'az', 'Asia', 'Azerbaijan');
INSERT INTO `flags` VALUES (18, 'Nassau', 'bs', 'North America', 'Bahamas');
INSERT INTO `flags` VALUES (19, 'Manama', 'bh', 'Asia', 'Bahrain');
INSERT INTO `flags` VALUES (20, 'Dhaka', 'bd', 'Asia', 'Bangladesh');
INSERT INTO `flags` VALUES (21, 'Bridgetown', 'bb', 'North America', 'Barbados');
INSERT INTO `flags` VALUES (22, 'Minsk', 'by', 'Europe', 'Belarus');
INSERT INTO `flags` VALUES (23, 'Brussels', 'be', 'Europe', 'Belgium');
INSERT INTO `flags` VALUES (24, 'Belmopan', 'bz', 'North America', 'Belize');
INSERT INTO `flags` VALUES (25, 'Porto-Novo', 'bj', 'Africa', 'Benin');
INSERT INTO `flags` VALUES (26, 'Hamilton', 'bm', 'North America', 'Bermuda');
INSERT INTO `flags` VALUES (27, 'Thimphu', 'bt', 'Asia', 'Bhutan');
INSERT INTO `flags` VALUES (28, 'Sucre', 'bo', 'South America', 'Bolivia');
INSERT INTO `flags` VALUES (29, 'Kralendijk', 'bq', 'South America', 'Bonaire, Sint Eustatius and Saba');
INSERT INTO `flags` VALUES (30, 'Sarajevo', 'ba', 'Europe', 'Bosnia and Herzegovina');
INSERT INTO `flags` VALUES (31, 'Gaborone', 'bw', 'Africa', 'Botswana');
INSERT INTO `flags` VALUES (32, '', 'bv', '', 'Bouvet Island');
INSERT INTO `flags` VALUES (33, 'Brasília', 'br', 'South America', 'Brazil');
INSERT INTO `flags` VALUES (34, 'Diego Garcia', 'io', 'Asia', 'British Indian Ocean Territory');
INSERT INTO `flags` VALUES (35, 'Bandar Seri Begawan', 'bn', 'Asia', 'Brunei Darussalam');
INSERT INTO `flags` VALUES (36, 'Sofia', 'bg', 'Europe', 'Bulgaria');
INSERT INTO `flags` VALUES (37, 'Ouagadougou', 'bf', 'Africa', 'Burkina Faso');
INSERT INTO `flags` VALUES (38, 'Bujumbura', 'bi', 'Africa', 'Burundi');
INSERT INTO `flags` VALUES (39, 'Praia', 'cv', 'Africa', 'Cabo Verde');
INSERT INTO `flags` VALUES (40, 'Phnom Penh', 'kh', 'Asia', 'Cambodia');
INSERT INTO `flags` VALUES (41, 'Yaoundé', 'cm', 'Africa', 'Cameroon');
INSERT INTO `flags` VALUES (42, 'Ottawa', 'ca', 'North America', 'Canada');
INSERT INTO `flags` VALUES (43, '', 'ic', '', 'Canary Islands');
INSERT INTO `flags` VALUES (44, '', 'es-ct', '', 'Catalonia');
INSERT INTO `flags` VALUES (45, 'George Town', 'ky', 'North America', 'Cayman Islands');
INSERT INTO `flags` VALUES (46, 'Bangui', 'cf', 'Africa', 'Central African Republic');
INSERT INTO `flags` VALUES (47, '', 'cefta', '', 'Central European Free Trade Agreement');
INSERT INTO `flags` VALUES (48, '', 'ea', '', 'Ceuta & Melilla');
INSERT INTO `flags` VALUES (49, 'N\'Djamena', 'td', 'Africa', 'Chad');
INSERT INTO `flags` VALUES (50, 'Santiago', 'cl', 'South America', 'Chile');
INSERT INTO `flags` VALUES (51, 'Beijing', 'cn', 'Asia', 'China');
INSERT INTO `flags` VALUES (52, 'Flying Fish Cove', 'cx', 'Asia', 'Christmas Island');
INSERT INTO `flags` VALUES (53, '', 'cp', '', 'Clipperton Island');
INSERT INTO `flags` VALUES (54, 'West Island', 'cc', 'Asia', 'Cocos (Keeling) Islands');
INSERT INTO `flags` VALUES (55, 'Bogotá', 'co', 'South America', 'Colombia');
INSERT INTO `flags` VALUES (56, 'Moroni', 'km', 'Africa', 'Comoros');
INSERT INTO `flags` VALUES (57, 'Avarua', 'ck', 'Oceania', 'Cook Islands');
INSERT INTO `flags` VALUES (58, 'San José', 'cr', 'North America', 'Costa Rica');
INSERT INTO `flags` VALUES (59, 'Zagreb', 'hr', 'Europe', 'Croatia');
INSERT INTO `flags` VALUES (60, 'Havana', 'cu', 'North America', 'Cuba');
INSERT INTO `flags` VALUES (61, 'Willemstad', 'cw', 'South America', 'Curaçao');
INSERT INTO `flags` VALUES (62, 'Nicosia', 'cy', 'Europe', 'Cyprus');
INSERT INTO `flags` VALUES (63, 'Prague', 'cz', 'Europe', 'Czech Republic');
INSERT INTO `flags` VALUES (64, 'Yamoussoukro', 'ci', 'Africa', 'Côte d\'Ivoire');
INSERT INTO `flags` VALUES (65, 'Kinshasa', 'cd', 'Africa', 'Democratic Republic of the Congo');
INSERT INTO `flags` VALUES (66, 'Copenhagen', 'dk', 'Europe', 'Denmark');
INSERT INTO `flags` VALUES (67, '', 'dg', '', 'Diego Garcia');
INSERT INTO `flags` VALUES (68, 'Djibouti', 'dj', 'Africa', 'Djibouti');
INSERT INTO `flags` VALUES (69, 'Roseau', 'dm', 'North America', 'Dominica');
INSERT INTO `flags` VALUES (70, 'Santo Domingo', 'do', 'North America', 'Dominican Republic');
INSERT INTO `flags` VALUES (71, 'Quito', 'ec', 'South America', 'Ecuador');
INSERT INTO `flags` VALUES (72, 'Cairo', 'eg', 'Africa', 'Egypt');
INSERT INTO `flags` VALUES (73, 'San Salvador', 'sv', 'North America', 'El Salvador');
INSERT INTO `flags` VALUES (74, 'London', 'gb-eng', 'Europe', 'England');
INSERT INTO `flags` VALUES (75, 'Malabo', 'gq', 'Africa', 'Equatorial Guinea');
INSERT INTO `flags` VALUES (76, 'Asmara', 'er', 'Africa', 'Eritrea');
INSERT INTO `flags` VALUES (77, 'Tallinn', 'ee', 'Europe', 'Estonia');
INSERT INTO `flags` VALUES (78, 'Lobamba, Mbabane', 'sz', 'Africa', 'Eswatini');
INSERT INTO `flags` VALUES (79, 'Addis Ababa', 'et', 'Africa', 'Ethiopia');
INSERT INTO `flags` VALUES (80, '', 'eu', '', 'Europe');
INSERT INTO `flags` VALUES (81, 'Stanley', 'fk', 'South America', 'Falkland Islands');
INSERT INTO `flags` VALUES (82, 'Tórshavn', 'fo', 'Europe', 'Faroe Islands');
INSERT INTO `flags` VALUES (83, 'Palikir', 'fm', 'Oceania', 'Federated States of Micronesia');
INSERT INTO `flags` VALUES (84, 'Suva', 'fj', 'Oceania', 'Fiji');
INSERT INTO `flags` VALUES (85, 'Helsinki', 'fi', 'Europe', 'Finland');
INSERT INTO `flags` VALUES (86, 'Paris', 'fr', 'Europe', 'France');
INSERT INTO `flags` VALUES (87, 'Cayenne', 'gf', 'South America', 'French Guiana');
INSERT INTO `flags` VALUES (88, 'Papeete', 'pf', 'Oceania', 'French Polynesia');
INSERT INTO `flags` VALUES (89, 'Saint-Pierre, Réunion', 'tf', 'Africa', 'French Southern Territories');
INSERT INTO `flags` VALUES (90, 'Libreville', 'ga', 'Africa', 'Gabon');
INSERT INTO `flags` VALUES (91, '', 'es-ga', '', 'Galicia');
INSERT INTO `flags` VALUES (92, 'Banjul', 'gm', 'Africa', 'Gambia');
INSERT INTO `flags` VALUES (93, 'Tbilisi', 'ge', 'Asia', 'Georgia');
INSERT INTO `flags` VALUES (94, 'Berlin', 'de', 'Europe', 'Germany');
INSERT INTO `flags` VALUES (95, 'Accra', 'gh', 'Africa', 'Ghana');
INSERT INTO `flags` VALUES (96, 'Gibraltar', 'gi', 'Europe', 'Gibraltar');
INSERT INTO `flags` VALUES (97, 'Athens', 'gr', 'Europe', 'Greece');
INSERT INTO `flags` VALUES (98, 'Nuuk', 'gl', 'North America', 'Greenland');
INSERT INTO `flags` VALUES (99, 'St. George\'s', 'gd', 'North America', 'Grenada');
INSERT INTO `flags` VALUES (100, 'Basse-Terre', 'gp', 'North America', 'Guadeloupe');
INSERT INTO `flags` VALUES (101, 'Hagåtña', 'gu', 'Oceania', 'Guam');
INSERT INTO `flags` VALUES (102, 'Guatemala City', 'gt', 'North America', 'Guatemala');
INSERT INTO `flags` VALUES (103, 'Saint Peter Port', 'gg', 'Europe', 'Guernsey');
INSERT INTO `flags` VALUES (104, 'Conakry', 'gn', 'Africa', 'Guinea');
INSERT INTO `flags` VALUES (105, 'Bissau', 'gw', 'Africa', 'Guinea-Bissau');
INSERT INTO `flags` VALUES (106, 'Georgetown', 'gy', 'South America', 'Guyana');
INSERT INTO `flags` VALUES (107, 'Port-au-Prince', 'ht', 'North America', 'Haiti');
INSERT INTO `flags` VALUES (108, '', 'hm', '', 'Heard Island and McDonald Islands');
INSERT INTO `flags` VALUES (109, 'Vatican City', 'va', 'Europe', 'Holy See');
INSERT INTO `flags` VALUES (110, 'Tegucigalpa', 'hn', 'North America', 'Honduras');
INSERT INTO `flags` VALUES (111, 'Hong Kong', 'hk', 'Asia', 'Hong Kong');
INSERT INTO `flags` VALUES (112, 'Budapest', 'hu', 'Europe', 'Hungary');
INSERT INTO `flags` VALUES (113, 'Reykjavik', 'is', 'Europe', 'Iceland');
INSERT INTO `flags` VALUES (114, 'New Delhi', 'in', 'Asia', 'India');
INSERT INTO `flags` VALUES (115, 'Jakarta', 'id', 'Asia', 'Indonesia');
INSERT INTO `flags` VALUES (116, 'Tehran', 'ir', 'Asia', 'Iran');
INSERT INTO `flags` VALUES (117, 'Baghdad', 'iq', 'Asia', 'Iraq');
INSERT INTO `flags` VALUES (118, 'Dublin', 'ie', 'Europe', 'Ireland');
INSERT INTO `flags` VALUES (119, 'Douglas', 'im', 'Europe', 'Isle of Man');
INSERT INTO `flags` VALUES (120, 'Jerusalem', 'il', 'Asia', 'Israel');
INSERT INTO `flags` VALUES (121, 'Rome', 'it', 'Europe', 'Italy');
INSERT INTO `flags` VALUES (122, 'Kingston', 'jm', 'North America', 'Jamaica');
INSERT INTO `flags` VALUES (123, 'Tokyo', 'jp', 'Asia', 'Japan');
INSERT INTO `flags` VALUES (124, 'Saint Helier', 'je', 'Europe', 'Jersey');
INSERT INTO `flags` VALUES (125, 'Amman', 'jo', 'Asia', 'Jordan');
INSERT INTO `flags` VALUES (126, 'Astana', 'kz', 'Asia', 'Kazakhstan');
INSERT INTO `flags` VALUES (127, 'Nairobi', 'ke', 'Africa', 'Kenya');
INSERT INTO `flags` VALUES (128, 'South Tarawa', 'ki', 'Oceania', 'Kiribati');
INSERT INTO `flags` VALUES (129, 'Pristina', 'xk', 'Europe', 'Kosovo');
INSERT INTO `flags` VALUES (130, 'Kuwait City', 'kw', 'Asia', 'Kuwait');
INSERT INTO `flags` VALUES (131, 'Bishkek', 'kg', 'Asia', 'Kyrgyzstan');
INSERT INTO `flags` VALUES (132, 'Vientiane', 'la', 'Asia', 'Laos');
INSERT INTO `flags` VALUES (133, 'Riga', 'lv', 'Europe', 'Latvia');
INSERT INTO `flags` VALUES (134, 'Beirut', 'lb', 'Asia', 'Lebanon');
INSERT INTO `flags` VALUES (135, 'Maseru', 'ls', 'Africa', 'Lesotho');
INSERT INTO `flags` VALUES (136, 'Monrovia', 'lr', 'Africa', 'Liberia');
INSERT INTO `flags` VALUES (137, 'Tripoli', 'ly', 'Africa', 'Libya');
INSERT INTO `flags` VALUES (138, 'Vaduz', 'li', 'Europe', 'Liechtenstein');
INSERT INTO `flags` VALUES (139, 'Vilnius', 'lt', 'Europe', 'Lithuania');
INSERT INTO `flags` VALUES (140, 'Luxembourg City', 'lu', 'Europe', 'Luxembourg');
INSERT INTO `flags` VALUES (141, 'Macau', 'mo', 'Asia', 'Macau');
INSERT INTO `flags` VALUES (142, 'Antananarivo', 'mg', 'Africa', 'Madagascar');
INSERT INTO `flags` VALUES (143, 'Lilongwe', 'mw', 'Africa', 'Malawi');
INSERT INTO `flags` VALUES (144, 'Kuala Lumpur', 'my', 'Asia', 'Malaysia');
INSERT INTO `flags` VALUES (145, 'Malé', 'mv', 'Asia', 'Maldives');
INSERT INTO `flags` VALUES (146, 'Bamako', 'ml', 'Africa', 'Mali');
INSERT INTO `flags` VALUES (147, 'Valletta', 'mt', 'Europe', 'Malta');
INSERT INTO `flags` VALUES (148, 'Majuro', 'mh', 'Oceania', 'Marshall Islands');
INSERT INTO `flags` VALUES (149, 'Fort-de-France', 'mq', 'North America', 'Martinique');
INSERT INTO `flags` VALUES (150, 'Nouakchott', 'mr', 'Africa', 'Mauritania');
INSERT INTO `flags` VALUES (151, 'Port Louis', 'mu', 'Africa', 'Mauritius');
INSERT INTO `flags` VALUES (152, 'Mamoudzou', 'yt', 'Africa', 'Mayotte');
INSERT INTO `flags` VALUES (153, 'Mexico City', 'mx', 'North America', 'Mexico');
INSERT INTO `flags` VALUES (154, 'Chișinău', 'md', 'Europe', 'Moldova');
INSERT INTO `flags` VALUES (155, 'Monaco', 'mc', 'Europe', 'Monaco');
INSERT INTO `flags` VALUES (156, 'Ulaanbaatar', 'mn', 'Asia', 'Mongolia');
INSERT INTO `flags` VALUES (157, 'Podgorica', 'me', 'Europe', 'Montenegro');
INSERT INTO `flags` VALUES (158, 'Little Bay, Brades, Plymouth', 'ms', 'North America', 'Montserrat');
INSERT INTO `flags` VALUES (159, 'Rabat', 'ma', 'Africa', 'Morocco');
INSERT INTO `flags` VALUES (160, 'Maputo', 'mz', 'Africa', 'Mozambique');
INSERT INTO `flags` VALUES (161, 'Naypyidaw', 'mm', 'Asia', 'Myanmar');
INSERT INTO `flags` VALUES (162, 'Windhoek', 'na', 'Africa', 'Namibia');
INSERT INTO `flags` VALUES (163, 'Yaren District', 'nr', 'Oceania', 'Nauru');
INSERT INTO `flags` VALUES (164, 'Kathmandu', 'np', 'Asia', 'Nepal');
INSERT INTO `flags` VALUES (165, 'Amsterdam', 'nl', 'Europe', 'Netherlands');
INSERT INTO `flags` VALUES (166, 'Nouméa', 'nc', 'Oceania', 'New Caledonia');
INSERT INTO `flags` VALUES (167, 'Wellington', 'nz', 'Oceania', 'New Zealand');
INSERT INTO `flags` VALUES (168, 'Managua', 'ni', 'North America', 'Nicaragua');
INSERT INTO `flags` VALUES (169, 'Niamey', 'ne', 'Africa', 'Niger');
INSERT INTO `flags` VALUES (170, 'Abuja', 'ng', 'Africa', 'Nigeria');
INSERT INTO `flags` VALUES (171, 'Alofi', 'nu', 'Oceania', 'Niue');
INSERT INTO `flags` VALUES (172, 'Kingston', 'nf', 'Oceania', 'Norfolk Island');
INSERT INTO `flags` VALUES (173, 'Pyongyang', 'kp', 'Asia', 'North Korea');
INSERT INTO `flags` VALUES (174, 'Skopje', 'mk', 'Europe', 'North Macedonia');
INSERT INTO `flags` VALUES (175, 'Belfast', 'gb-nir', 'Europe', 'Northern Ireland');
INSERT INTO `flags` VALUES (176, 'Saipan', 'mp', 'Oceania', 'Northern Mariana Islands');
INSERT INTO `flags` VALUES (177, 'Oslo', 'no', 'Europe', 'Norway');
INSERT INTO `flags` VALUES (178, 'Muscat', 'om', 'Asia', 'Oman');
INSERT INTO `flags` VALUES (179, 'Islamabad', 'pk', 'Asia', 'Pakistan');
INSERT INTO `flags` VALUES (180, 'Ngerulmud', 'pw', 'Oceania', 'Palau');
INSERT INTO `flags` VALUES (181, 'Panama City', 'pa', 'North America', 'Panama');
INSERT INTO `flags` VALUES (182, 'Port Moresby', 'pg', 'Oceania', 'Papua New Guinea');
INSERT INTO `flags` VALUES (183, 'Asunción', 'py', 'South America', 'Paraguay');
INSERT INTO `flags` VALUES (184, 'Lima', 'pe', 'South America', 'Peru');
INSERT INTO `flags` VALUES (185, 'Manila', 'ph', 'Asia', 'Philippines');
INSERT INTO `flags` VALUES (186, 'Adamstown', 'pn', 'Oceania', 'Pitcairn');
INSERT INTO `flags` VALUES (187, 'Warsaw', 'pl', 'Europe', 'Poland');
INSERT INTO `flags` VALUES (188, 'Lisbon', 'pt', 'Europe', 'Portugal');
INSERT INTO `flags` VALUES (189, 'San Juan', 'pr', 'North America', 'Puerto Rico');
INSERT INTO `flags` VALUES (190, 'Doha', 'qa', 'Asia', 'Qatar');
INSERT INTO `flags` VALUES (191, 'Brazzaville', 'cg', 'Africa', 'Republic of the Congo');
INSERT INTO `flags` VALUES (192, 'Bucharest', 'ro', 'Europe', 'Romania');
INSERT INTO `flags` VALUES (193, 'Moscow', 'ru', 'Europe', 'Russia');
INSERT INTO `flags` VALUES (194, 'Kigali', 'rw', 'Africa', 'Rwanda');
INSERT INTO `flags` VALUES (195, 'Saint-Denis', 're', 'Africa', 'Réunion');
INSERT INTO `flags` VALUES (196, 'Gustavia', 'bl', 'North America', 'Saint Barthélemy');
INSERT INTO `flags` VALUES (197, 'Jamestown', 'sh', 'Africa', 'Saint Helena, Ascension and Tristan da Cunha');
INSERT INTO `flags` VALUES (198, 'Basseterre', 'kn', 'North America', 'Saint Kitts and Nevis');
INSERT INTO `flags` VALUES (199, 'Castries', 'lc', 'North America', 'Saint Lucia');
INSERT INTO `flags` VALUES (200, 'Marigot', 'mf', 'North America', 'Saint Martin');
INSERT INTO `flags` VALUES (201, 'Saint-Pierre', 'pm', 'North America', 'Saint Pierre and Miquelon');
INSERT INTO `flags` VALUES (202, 'Kingstown', 'vc', 'North America', 'Saint Vincent and the Grenadines');
INSERT INTO `flags` VALUES (203, 'Apia', 'ws', 'Oceania', 'Samoa');
INSERT INTO `flags` VALUES (204, 'San Marino', 'sm', 'Europe', 'San Marino');
INSERT INTO `flags` VALUES (205, 'São Tomé', 'st', 'Africa', 'Sao Tome and Principe');
INSERT INTO `flags` VALUES (206, 'Riyadh', 'sa', 'Asia', 'Saudi Arabia');
INSERT INTO `flags` VALUES (207, 'Edinburgh', 'gb-sct', 'Europe', 'Scotland');
INSERT INTO `flags` VALUES (208, 'Dakar', 'sn', 'Africa', 'Senegal');
INSERT INTO `flags` VALUES (209, 'Belgrade', 'rs', 'Europe', 'Serbia');
INSERT INTO `flags` VALUES (210, 'Victoria', 'sc', 'Africa', 'Seychelles');
INSERT INTO `flags` VALUES (211, 'Freetown', 'sl', 'Africa', 'Sierra Leone');
INSERT INTO `flags` VALUES (212, 'Singapore', 'sg', 'Asia', 'Singapore');
INSERT INTO `flags` VALUES (213, 'Philipsburg', 'sx', 'North America', 'Sint Maarten');
INSERT INTO `flags` VALUES (214, 'Bratislava', 'sk', 'Europe', 'Slovakia');
INSERT INTO `flags` VALUES (215, 'Ljubljana', 'si', 'Europe', 'Slovenia');
INSERT INTO `flags` VALUES (216, 'Honiara', 'sb', 'Oceania', 'Solomon Islands');
INSERT INTO `flags` VALUES (217, 'Mogadishu', 'so', 'Africa', 'Somalia');
INSERT INTO `flags` VALUES (218, 'Pretoria', 'za', 'Africa', 'South Africa');
INSERT INTO `flags` VALUES (219, 'King Edward Point', 'gs', 'Antarctica', 'South Georgia and the South Sandwich Islands');
INSERT INTO `flags` VALUES (220, 'Seoul', 'kr', 'Asia', 'South Korea');
INSERT INTO `flags` VALUES (221, 'Juba', 'ss', 'Africa', 'South Sudan');
INSERT INTO `flags` VALUES (222, 'Madrid', 'es', 'Europe', 'Spain');
INSERT INTO `flags` VALUES (223, 'Sri Jayawardenepura Kotte, Colombo', 'lk', 'Asia', 'Sri Lanka');
INSERT INTO `flags` VALUES (224, 'Ramallah', 'ps', 'Asia', 'State of Palestine');
INSERT INTO `flags` VALUES (225, 'Khartoum', 'sd', 'Africa', 'Sudan');
INSERT INTO `flags` VALUES (226, 'Paramaribo', 'sr', 'South America', 'Suriname');
INSERT INTO `flags` VALUES (227, 'Longyearbyen', 'sj', 'Europe', 'Svalbard and Jan Mayen');
INSERT INTO `flags` VALUES (228, 'Stockholm', 'se', 'Europe', 'Sweden');
INSERT INTO `flags` VALUES (229, 'Bern', 'ch', 'Europe', 'Switzerland');
INSERT INTO `flags` VALUES (230, 'Damascus', 'sy', 'Asia', 'Syria');
INSERT INTO `flags` VALUES (231, 'Taipei', 'tw', 'Asia', 'Taiwan');
INSERT INTO `flags` VALUES (232, 'Dushanbe', 'tj', 'Asia', 'Tajikistan');
INSERT INTO `flags` VALUES (233, 'Dodoma', 'tz', 'Africa', 'Tanzania');
INSERT INTO `flags` VALUES (234, 'Bangkok', 'th', 'Asia', 'Thailand');
INSERT INTO `flags` VALUES (235, 'Dili', 'tl', 'Asia', 'Timor-Leste');
INSERT INTO `flags` VALUES (236, 'Lomé', 'tg', 'Africa', 'Togo');
INSERT INTO `flags` VALUES (237, 'Nukunonu, Atafu,Tokelau', 'tk', 'Oceania', 'Tokelau');
INSERT INTO `flags` VALUES (238, 'Nukuʻalofa', 'to', 'Oceania', 'Tonga');
INSERT INTO `flags` VALUES (239, 'Port of Spain', 'tt', 'South America', 'Trinidad and Tobago');
INSERT INTO `flags` VALUES (240, '', 'ta', '', 'Tristan da Cunha');
INSERT INTO `flags` VALUES (241, 'Tunis', 'tn', 'Africa', 'Tunisia');
INSERT INTO `flags` VALUES (242, 'Ankara', 'tr', 'Asia', 'Turkey');
INSERT INTO `flags` VALUES (243, 'Ashgabat', 'tm', 'Asia', 'Turkmenistan');
INSERT INTO `flags` VALUES (244, 'Cockburn Town', 'tc', 'North America', 'Turks and Caicos Islands');
INSERT INTO `flags` VALUES (245, 'Funafuti', 'tv', 'Oceania', 'Tuvalu');
INSERT INTO `flags` VALUES (246, 'Kampala', 'ug', 'Africa', 'Uganda');
INSERT INTO `flags` VALUES (247, 'Kiev', 'ua', 'Europe', 'Ukraine');
INSERT INTO `flags` VALUES (248, 'Abu Dhabi', 'ae', 'Asia', 'United Arab Emirates');
INSERT INTO `flags` VALUES (249, 'London', 'gb', 'Europe', 'United Kingdom');
INSERT INTO `flags` VALUES (250, '', 'un', '', 'United Nations');
INSERT INTO `flags` VALUES (251, 'Washington, D.C.', 'um', 'North America', 'United States Minor Outlying Islands');
INSERT INTO `flags` VALUES (252, 'Washington, D.C.', 'us', 'North America', 'United States of America');
INSERT INTO `flags` VALUES (253, '', 'xx', '', 'Unknown');
INSERT INTO `flags` VALUES (254, 'Montevideo', 'uy', 'South America', 'Uruguay');
INSERT INTO `flags` VALUES (255, 'Tashkent', 'uz', 'Asia', 'Uzbekistan');
INSERT INTO `flags` VALUES (256, 'Port Vila', 'vu', 'Oceania', 'Vanuatu');
INSERT INTO `flags` VALUES (257, 'Caracas', 've', 'South America', 'Venezuela');
INSERT INTO `flags` VALUES (258, 'Hanoi', 'vn', 'Asia', 'Vietnam');
INSERT INTO `flags` VALUES (259, 'Road Town', 'vg', 'North America', 'Virgin Islands (British)');
INSERT INTO `flags` VALUES (260, 'Charlotte Amalie', 'vi', 'North America', 'Virgin Islands (U.S.)');
INSERT INTO `flags` VALUES (261, 'Cardiff', 'gb-wls', 'Europe', 'Wales');
INSERT INTO `flags` VALUES (262, 'Mata-Utu', 'wf', 'Oceania', 'Wallis and Futuna');
INSERT INTO `flags` VALUES (263, 'Laayoune', 'eh', 'Africa', 'Western Sahara');
INSERT INTO `flags` VALUES (264, 'Sana\'a', 'ye', 'Asia', 'Yemen');
INSERT INTO `flags` VALUES (265, 'Lusaka', 'zm', 'Africa', 'Zambia');
INSERT INTO `flags` VALUES (266, 'Harare', 'zw', 'Africa', 'Zimbabwe');

-- ----------------------------
-- Table structure for gdpr_settings
-- ----------------------------
CREATE TABLE `gdpr_settings`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `enable_gdpr` tinyint(1) NOT NULL DEFAULT 0,
  `show_customer_area` tinyint(1) NOT NULL DEFAULT 0,
  `show_customer_footer` tinyint(1) NOT NULL DEFAULT 0,
  `top_information_block` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `enable_export` tinyint(1) NOT NULL DEFAULT 0,
  `data_removal` tinyint(1) NOT NULL DEFAULT 0,
  `lead_removal_public_form` tinyint(1) NOT NULL DEFAULT 0,
  `terms_customer_footer` tinyint(1) NOT NULL DEFAULT 0,
  `terms` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `policy` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `public_lead_edit` tinyint(1) NOT NULL DEFAULT 0,
  `consent_customer` tinyint(1) NOT NULL DEFAULT 0,
  `consent_leads` tinyint(1) NOT NULL DEFAULT 0,
  `consent_block` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of gdpr_settings
-- ----------------------------
INSERT INTO `gdpr_settings` VALUES (1, 0, 0, 0, NULL, 0, 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, '2023-06-19 19:34:13', '2023-06-19 19:34:13');

-- ----------------------------
-- Table structure for global_settings
-- ----------------------------
CREATE TABLE `global_settings`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `global_app_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `logo` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `light_logo` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `login_background` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `logo_background_color` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `header_color` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#1D82F5',
  `sidebar_logo_style` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT 'square',
  `locale` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'en',
  `hash` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `purchase_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `supported_until` timestamp NULL DEFAULT NULL,
  `last_license_verified_at` timestamp NULL DEFAULT NULL,
  `google_recaptcha_status` enum('active','deactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'deactive',
  `google_recaptcha_v2_status` enum('active','deactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'deactive',
  `google_recaptcha_v2_site_key` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `google_recaptcha_v2_secret_key` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `google_recaptcha_v3_status` enum('active','deactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'deactive',
  `google_recaptcha_v3_site_key` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `google_recaptcha_v3_secret_key` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `app_debug` tinyint(1) NOT NULL DEFAULT 0,
  `currency_converter_key` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `currency_key_version` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'free',
  `date_format` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'd-m-Y',
  `time_format` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'h:i a',
  `moment_format` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DD-MM-YYYY',
  `timezone` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Asia/Kolkata',
  `rtl` tinyint(1) NOT NULL DEFAULT 0,
  `license_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `hide_cron_message` tinyint(1) NOT NULL DEFAULT 0,
  `system_update` tinyint(1) NOT NULL DEFAULT 1,
  `show_review_modal` tinyint(1) NOT NULL DEFAULT 1,
  `last_cron_run` timestamp NULL DEFAULT NULL,
  `favicon` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `auth_theme` enum('dark','light') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'light',
  `auth_theme_text` enum('dark','light') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'dark',
  `session_driver` enum('file','database') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'file',
  `allowed_file_types` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `allowed_file_size` int NOT NULL DEFAULT 10,
  `allow_max_no_of_files` int NOT NULL DEFAULT 10,
  `datatable_row_limit` int NOT NULL DEFAULT 10,
  `show_update_popup` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `google_map_key` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `google_calendar_status` enum('active','inactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'inactive',
  `google_client_id` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `google_client_secret` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of global_settings
-- ----------------------------
INSERT INTO `global_settings` VALUES (1, 'BWatch', '713d45ffca831468c17844a797f07f08.png', '33f0c9c2178178fd820e9e0f7b19e5f1.png', NULL, '#FFFFFF', '#231F20', 'square', 'en', 'f768f603109e589c353be4b72867e93c', NULL, NULL, NULL, 'deactive', 'deactive', NULL, NULL, 'deactive', NULL, NULL, 0, '', 'free', 'd-m-Y', 'h:i a', 'DD-MM-YYYY', 'Asia/Kolkata', 0, NULL, 0, 1, 1, NULL, 'dc9f613b444dded14ae8811ed3705883.png', 'light', 'dark', 'file', 'image/*,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/docx,application/pdf,text/plain,application/msword,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/zip,application/x-zip-compressed, application/x-compressed, multipart/x-zip,.xlsx,video/x-flv,video/mp4,application/x-mpegURL,video/MP2T,video/3gpp,video/quicktime,video/x-msvideo,video/x-ms-wmv,application/sla,.stl', 10, 10, 10, 1, '2023-06-19 19:34:16', '2023-06-27 12:16:14', NULL, 'inactive', NULL, NULL);

-- ----------------------------
-- Table structure for google_calendar_modules
-- ----------------------------
CREATE TABLE `google_calendar_modules`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `lead_status` tinyint(1) NOT NULL DEFAULT 0,
  `leave_status` tinyint(1) NOT NULL DEFAULT 0,
  `invoice_status` tinyint(1) NOT NULL DEFAULT 0,
  `contract_status` tinyint(1) NOT NULL DEFAULT 0,
  `task_status` tinyint(1) NOT NULL DEFAULT 0,
  `event_status` tinyint(1) NOT NULL DEFAULT 0,
  `holiday_status` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `google_calendar_modules_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `google_calendar_modules_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of google_calendar_modules
-- ----------------------------
INSERT INTO `google_calendar_modules` VALUES (1, 1, 0, 0, 0, 0, 0, 0, 0, '2023-06-19 19:34:17', '2023-06-19 19:34:17');

-- ----------------------------
-- Table structure for holidays
-- ----------------------------
CREATE TABLE `holidays`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `date` date NOT NULL,
  `occassion` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `event_id` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `holidays_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `holidays_date_index`(`date` ASC) USING BTREE,
  INDEX `holidays_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `holidays_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `holidays_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `holidays_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `holidays_ibfk_3` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of holidays
-- ----------------------------

-- ----------------------------
-- Table structure for invoice_files
-- ----------------------------
CREATE TABLE `invoice_files`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `invoice_id` int UNSIGNED NOT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `filename` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `hashname` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `size` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `invoice_files_invoice_id_foreign`(`invoice_id` ASC) USING BTREE,
  INDEX `invoice_files_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `invoice_files_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `invoice_files_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `invoice_files_ibfk_2` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `invoice_files_ibfk_3` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of invoice_files
-- ----------------------------

-- ----------------------------
-- Table structure for invoice_item_images
-- ----------------------------
CREATE TABLE `invoice_item_images`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `invoice_item_id` int UNSIGNED NOT NULL,
  `filename` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `hashname` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `size` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `external_link` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `invoice_item_images_invoice_item_id_foreign`(`invoice_item_id` ASC) USING BTREE,
  CONSTRAINT `invoice_item_images_ibfk_1` FOREIGN KEY (`invoice_item_id`) REFERENCES `invoice_items` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of invoice_item_images
-- ----------------------------

-- ----------------------------
-- Table structure for invoice_items
-- ----------------------------
CREATE TABLE `invoice_items`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `invoice_id` int UNSIGNED NOT NULL,
  `item_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `item_summary` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `type` enum('item','discount','tax') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'item',
  `quantity` double(16, 2) NOT NULL,
  `unit_price` double(16, 2) NOT NULL,
  `amount` double(16, 2) NOT NULL,
  `taxes` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `hsn_sac_code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `unit_id` bigint UNSIGNED NULL DEFAULT NULL,
  `product_id` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `invoice_items_invoice_id_foreign`(`invoice_id` ASC) USING BTREE,
  INDEX `invoice_items_unit_id_foreign`(`unit_id` ASC) USING BTREE,
  INDEX `invoice_items_product_id_foreign`(`product_id` ASC) USING BTREE,
  CONSTRAINT `invoice_items_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `invoice_items_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `invoice_items_ibfk_3` FOREIGN KEY (`unit_id`) REFERENCES `unit_types` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of invoice_items
-- ----------------------------
INSERT INTO `invoice_items` VALUES (1, 1, 'asdasd', '', 'item', 1.00, 10.00, 10.00, NULL, NULL, '2023-06-27 10:14:10', '2023-06-27 10:14:10', 1, NULL);

-- ----------------------------
-- Table structure for invoice_recurring
-- ----------------------------
CREATE TABLE `invoice_recurring`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `currency_id` int UNSIGNED NULL DEFAULT NULL,
  `project_id` int UNSIGNED NULL DEFAULT NULL,
  `client_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NULL DEFAULT NULL,
  `created_by` int UNSIGNED NULL DEFAULT NULL,
  `issue_date` date NOT NULL,
  `next_invoice_date` date NULL DEFAULT NULL,
  `due_date` date NOT NULL,
  `sub_total` double NOT NULL DEFAULT 0,
  `total` double NOT NULL DEFAULT 0,
  `discount` double NOT NULL DEFAULT 0,
  `discount_type` enum('percent','fixed') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'percent',
  `status` enum('active','inactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active',
  `file` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `file_original_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `show_shipping_address` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `day_of_month` int NULL DEFAULT 1,
  `day_of_week` int NULL DEFAULT 1,
  `payment_method` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `rotation` enum('monthly','weekly','bi-weekly','quarterly','half-yearly','annually','daily') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `billing_cycle` int NULL DEFAULT NULL,
  `client_can_stop` tinyint(1) NOT NULL DEFAULT 1,
  `unlimited_recurring` tinyint(1) NOT NULL DEFAULT 0,
  `deleted_at` datetime NULL DEFAULT NULL,
  `shipping_address` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `calculate_tax` enum('after_discount','before_discount') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'after_discount',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `immediate_invoice` tinyint(1) NOT NULL DEFAULT 0,
  `bank_account_id` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `invoice_recurring_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `invoice_recurring_currency_id_foreign`(`currency_id` ASC) USING BTREE,
  INDEX `invoice_recurring_project_id_foreign`(`project_id` ASC) USING BTREE,
  INDEX `invoice_recurring_client_id_foreign`(`client_id` ASC) USING BTREE,
  INDEX `invoice_recurring_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `invoice_recurring_created_by_foreign`(`created_by` ASC) USING BTREE,
  INDEX `invoice_recurring_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `invoice_recurring_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  INDEX `invoice_recurring_bank_account_id_foreign`(`bank_account_id` ASC) USING BTREE,
  CONSTRAINT `invoice_recurring_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `invoice_recurring_ibfk_2` FOREIGN KEY (`bank_account_id`) REFERENCES `bank_accounts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `invoice_recurring_ibfk_3` FOREIGN KEY (`client_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `invoice_recurring_ibfk_4` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `invoice_recurring_ibfk_5` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `invoice_recurring_ibfk_6` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `invoice_recurring_ibfk_7` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `invoice_recurring_ibfk_8` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `invoice_recurring_ibfk_9` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of invoice_recurring
-- ----------------------------

-- ----------------------------
-- Table structure for invoice_recurring_item_images
-- ----------------------------
CREATE TABLE `invoice_recurring_item_images`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `invoice_recurring_item_id` int UNSIGNED NOT NULL,
  `filename` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `hashname` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `size` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `external_link` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `invoice_recurring_item_images_invoice_recurring_item_id_foreign`(`invoice_recurring_item_id` ASC) USING BTREE,
  CONSTRAINT `invoice_recurring_item_images_ibfk_1` FOREIGN KEY (`invoice_recurring_item_id`) REFERENCES `invoice_recurring_items` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of invoice_recurring_item_images
-- ----------------------------

-- ----------------------------
-- Table structure for invoice_recurring_items
-- ----------------------------
CREATE TABLE `invoice_recurring_items`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `invoice_recurring_id` bigint UNSIGNED NOT NULL,
  `item_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `quantity` double NOT NULL,
  `unit_price` double NOT NULL,
  `amount` double NOT NULL,
  `taxes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `type` enum('item','discount','tax') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'item',
  `item_summary` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `hsn_sac_code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `unit_id` bigint UNSIGNED NULL DEFAULT NULL,
  `product_id` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `invoice_recurring_items_invoice_recurring_id_foreign`(`invoice_recurring_id` ASC) USING BTREE,
  INDEX `invoice_recurring_items_unit_id_foreign`(`unit_id` ASC) USING BTREE,
  INDEX `invoice_recurring_items_product_id_foreign`(`product_id` ASC) USING BTREE,
  CONSTRAINT `invoice_recurring_items_ibfk_1` FOREIGN KEY (`invoice_recurring_id`) REFERENCES `invoice_recurring` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `invoice_recurring_items_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `invoice_recurring_items_ibfk_3` FOREIGN KEY (`unit_id`) REFERENCES `unit_types` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of invoice_recurring_items
-- ----------------------------

-- ----------------------------
-- Table structure for invoice_settings
-- ----------------------------
CREATE TABLE `invoice_settings`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `invoice_prefix` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `invoice_number_separator` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#',
  `invoice_digit` int UNSIGNED NOT NULL DEFAULT 3,
  `estimate_prefix` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EST',
  `estimate_number_separator` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#',
  `estimate_digit` int UNSIGNED NOT NULL DEFAULT 3,
  `credit_note_prefix` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'CN',
  `credit_note_number_separator` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#',
  `credit_note_digit` int UNSIGNED NOT NULL DEFAULT 3,
  `contract_prefix` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'CONT',
  `contract_number_separator` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#',
  `contract_digit` int UNSIGNED NOT NULL DEFAULT 3,
  `order_prefix` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ODR',
  `order_number_separator` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#',
  `order_digit` int UNSIGNED NOT NULL DEFAULT 3,
  `template` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `due_after` int NOT NULL,
  `invoice_terms` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `estimate_terms` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `gst_number` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `show_gst` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT 'no',
  `logo` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `hsn_sac_code_show` tinyint(1) NOT NULL DEFAULT 0,
  `locale` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT 'en',
  `send_reminder` int NOT NULL DEFAULT 0,
  `reminder` enum('after','every') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `send_reminder_after` int NOT NULL DEFAULT 0,
  `tax_calculation_msg` tinyint(1) NOT NULL DEFAULT 0,
  `show_status` tinyint(1) NOT NULL DEFAULT 1,
  `authorised_signatory` tinyint(1) NOT NULL DEFAULT 0,
  `authorised_signatory_signature` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `show_project` int NOT NULL DEFAULT 0,
  `show_client_name` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT 'no',
  `show_client_email` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT 'no',
  `show_client_phone` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT 'no',
  `show_client_company_address` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT 'no',
  `show_client_company_name` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT 'no',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `invoice_settings_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `invoice_settings_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of invoice_settings
-- ----------------------------
INSERT INTO `invoice_settings` VALUES (1, 1, 'INV', '#', 3, 'EST', '#', 3, 'CN', '#', 3, 'CONT', '#', 3, 'ODR', '#', 3, 'invoice-5', 15, 'Thank you for your business.', NULL, NULL, 'no', NULL, 0, 'en', 0, NULL, 0, 0, 1, 0, NULL, 0, 'yes', 'yes', 'yes', 'yes', 'yes', '2023-06-19 19:34:17', '2023-06-19 19:34:17');

-- ----------------------------
-- Table structure for invoices
-- ----------------------------
CREATE TABLE `invoices`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `project_id` int UNSIGNED NULL DEFAULT NULL,
  `client_id` int UNSIGNED NULL DEFAULT NULL,
  `order_id` bigint UNSIGNED NULL DEFAULT NULL,
  `invoice_number` bigint NOT NULL,
  `issue_date` date NOT NULL,
  `due_date` date NOT NULL,
  `sub_total` double(16, 2) NOT NULL,
  `discount` double NOT NULL DEFAULT 0,
  `discount_type` enum('percent','fixed') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'percent',
  `total` double(16, 2) NOT NULL,
  `currency_id` int UNSIGNED NULL DEFAULT NULL,
  `default_currency_id` int UNSIGNED NULL DEFAULT NULL,
  `exchange_rate` double NULL DEFAULT NULL,
  `status` enum('paid','unpaid','partial','canceled','draft') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'unpaid',
  `recurring` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `billing_cycle` int NULL DEFAULT NULL,
  `billing_interval` int NULL DEFAULT NULL,
  `billing_frequency` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `file` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `file_original_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `credit_note` tinyint(1) NOT NULL DEFAULT 0,
  `show_shipping_address` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'no',
  `estimate_id` int UNSIGNED NULL DEFAULT NULL,
  `send_status` tinyint(1) NOT NULL DEFAULT 1,
  `due_amount` double(8, 2) NOT NULL DEFAULT 0.00,
  `parent_id` int UNSIGNED NULL DEFAULT NULL,
  `invoice_recurring_id` bigint UNSIGNED NULL DEFAULT NULL,
  `created_by` int UNSIGNED NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `hash` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `calculate_tax` enum('after_discount','before_discount') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'after_discount',
  `company_address_id` bigint UNSIGNED NULL DEFAULT NULL,
  `event_id` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `custom_invoice_number` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `payment_status` enum('1','0') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0',
  `offline_method_id` int UNSIGNED NULL DEFAULT NULL,
  `transaction_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `gateway` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `bank_account_id` int UNSIGNED NULL DEFAULT NULL,
  `last_viewed` timestamp NULL DEFAULT NULL,
  `ip_address` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `quickbooks_invoice_id` int NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `invoices_invoice_number_company_id_unique`(`invoice_number` ASC, `company_id` ASC) USING BTREE,
  UNIQUE INDEX `invoices_transaction_id_unique`(`transaction_id` ASC) USING BTREE,
  INDEX `invoices_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `invoices_project_id_foreign`(`project_id` ASC) USING BTREE,
  INDEX `invoices_client_id_foreign`(`client_id` ASC) USING BTREE,
  INDEX `invoices_order_id_foreign`(`order_id` ASC) USING BTREE,
  INDEX `invoices_due_date_index`(`due_date` ASC) USING BTREE,
  INDEX `invoices_currency_id_foreign`(`currency_id` ASC) USING BTREE,
  INDEX `invoices_estimate_id_foreign`(`estimate_id` ASC) USING BTREE,
  INDEX `invoices_parent_id_foreign`(`parent_id` ASC) USING BTREE,
  INDEX `invoices_invoice_recurring_id_foreign`(`invoice_recurring_id` ASC) USING BTREE,
  INDEX `invoices_created_by_foreign`(`created_by` ASC) USING BTREE,
  INDEX `invoices_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `invoices_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  INDEX `invoices_company_address_id_foreign`(`company_address_id` ASC) USING BTREE,
  INDEX `invoices_bank_account_id_foreign`(`bank_account_id` ASC) USING BTREE,
  INDEX `invoices_default_currency_id_foreign`(`default_currency_id` ASC) USING BTREE,
  INDEX `payments_offline_method_id_foreign`(`offline_method_id` ASC) USING BTREE,
  CONSTRAINT `invoices_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `invoices_ibfk_10` FOREIGN KEY (`invoice_recurring_id`) REFERENCES `invoice_recurring` (`id`) ON DELETE SET NULL ON UPDATE RESTRICT,
  CONSTRAINT `invoices_ibfk_11` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `invoices_ibfk_12` FOREIGN KEY (`offline_method_id`) REFERENCES `offline_payment_methods` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `invoices_ibfk_13` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `invoices_ibfk_14` FOREIGN KEY (`parent_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `invoices_ibfk_15` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `invoices_ibfk_2` FOREIGN KEY (`bank_account_id`) REFERENCES `bank_accounts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `invoices_ibfk_3` FOREIGN KEY (`client_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `invoices_ibfk_4` FOREIGN KEY (`company_address_id`) REFERENCES `company_addresses` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `invoices_ibfk_5` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `invoices_ibfk_6` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  CONSTRAINT `invoices_ibfk_7` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `invoices_ibfk_8` FOREIGN KEY (`default_currency_id`) REFERENCES `currencies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `invoices_ibfk_9` FOREIGN KEY (`estimate_id`) REFERENCES `estimates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of invoices
-- ----------------------------
INSERT INTO `invoices` VALUES (1, 1, NULL, 11, NULL, 1, '2023-06-27', '2023-06-29', 10.00, 0, 'percent', 10.00, 1, 1, 1, 'unpaid', 'no', NULL, NULL, NULL, NULL, NULL, '', 0, 'no', NULL, 0, 10.00, NULL, NULL, NULL, 2, 2, '57b101cf1cb882a86bd3c1e333780185', 'after_discount', 1, NULL, 'INV#001', '0', NULL, NULL, NULL, '2023-06-27 10:14:10', '2023-06-27 10:14:10', NULL, NULL, NULL, NULL);

-- ----------------------------
-- Table structure for issues
-- ----------------------------
CREATE TABLE `issues`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `description` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` int UNSIGNED NULL DEFAULT NULL,
  `project_id` int UNSIGNED NULL DEFAULT NULL,
  `status` enum('pending','resolved') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `issues_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `issues_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `issues_project_id_foreign`(`project_id` ASC) USING BTREE,
  CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `issues_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of issues
-- ----------------------------

-- ----------------------------
-- Table structure for job_batches
-- ----------------------------
CREATE TABLE `job_batches`  (
  `id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `total_jobs` int NOT NULL,
  `pending_jobs` int NOT NULL,
  `failed_jobs` int NOT NULL,
  `failed_job_ids` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `options` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `cancelled_at` int NULL DEFAULT NULL,
  `created_at` int NOT NULL,
  `finished_at` int NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of job_batches
-- ----------------------------

-- ----------------------------
-- Table structure for jobs
-- ----------------------------
CREATE TABLE `jobs`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `queue` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `attempts` tinyint UNSIGNED NOT NULL,
  `reserved_at` int UNSIGNED NULL DEFAULT NULL,
  `available_at` int UNSIGNED NOT NULL,
  `created_at` int UNSIGNED NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `jobs_queue_index`(`queue` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of jobs
-- ----------------------------

-- ----------------------------
-- Table structure for knowledge_base_files
-- ----------------------------
CREATE TABLE `knowledge_base_files`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `knowledge_base_id` int UNSIGNED NOT NULL,
  `filename` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `hashname` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `size` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `external_link_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `external_link` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `knowledge_base_files_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `knowledge_base_files_knowledge_base_id_foreign`(`knowledge_base_id` ASC) USING BTREE,
  INDEX `knowledge_base_files_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `knowledge_base_files_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `knowledge_base_files_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `knowledge_base_files_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `knowledge_base_files_ibfk_3` FOREIGN KEY (`knowledge_base_id`) REFERENCES `knowledge_bases` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `knowledge_base_files_ibfk_4` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of knowledge_base_files
-- ----------------------------

-- ----------------------------
-- Table structure for knowledge_bases
-- ----------------------------
CREATE TABLE `knowledge_bases`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `to` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'employee',
  `heading` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `category_id` int UNSIGNED NULL DEFAULT NULL,
  `description` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `added_by` int UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `knowledge_bases_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `knowledge_bases_category_id_foreign`(`category_id` ASC) USING BTREE,
  CONSTRAINT `knowledge_bases_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `knowledge_categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `knowledge_bases_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of knowledge_bases
-- ----------------------------

-- ----------------------------
-- Table structure for knowledge_categories
-- ----------------------------
CREATE TABLE `knowledge_categories`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `knowledge_categories_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `knowledge_categories_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of knowledge_categories
-- ----------------------------

-- ----------------------------
-- Table structure for language_settings
-- ----------------------------
CREATE TABLE `language_settings`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `language_code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `language_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` enum('enabled','disabled') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `flag_code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of language_settings
-- ----------------------------
INSERT INTO `language_settings` VALUES (1, 'en', 'English', 'enabled', NULL, NULL, 'en');
INSERT INTO `language_settings` VALUES (2, 'ar', 'Arabic', 'disabled', NULL, NULL, 'sa');
INSERT INTO `language_settings` VALUES (3, 'de', 'German', 'disabled', NULL, NULL, 'de');
INSERT INTO `language_settings` VALUES (4, 'es', 'Spanish', 'disabled', NULL, NULL, 'es');
INSERT INTO `language_settings` VALUES (5, 'et', 'Estonian', 'disabled', NULL, NULL, 'et');
INSERT INTO `language_settings` VALUES (6, 'fa', 'Farsi', 'disabled', NULL, NULL, 'ir');
INSERT INTO `language_settings` VALUES (7, 'fr', 'French', 'disabled', NULL, NULL, 'fr');
INSERT INTO `language_settings` VALUES (8, 'gr', 'Greek', 'disabled', NULL, NULL, 'gr');
INSERT INTO `language_settings` VALUES (9, 'it', 'Italian', 'disabled', NULL, NULL, 'it');
INSERT INTO `language_settings` VALUES (10, 'nl', 'Dutch', 'disabled', NULL, NULL, 'nl');
INSERT INTO `language_settings` VALUES (11, 'pl', 'Polish', 'disabled', NULL, NULL, 'pl');
INSERT INTO `language_settings` VALUES (12, 'pt', 'Portuguese', 'disabled', NULL, NULL, 'pt');
INSERT INTO `language_settings` VALUES (13, 'pt-br', 'Portuguese (Brazil)', 'disabled', NULL, NULL, 'br');
INSERT INTO `language_settings` VALUES (14, 'ro', 'Romanian', 'disabled', NULL, NULL, 'ro');
INSERT INTO `language_settings` VALUES (15, 'ru', 'Russian', 'disabled', NULL, NULL, 'ru');
INSERT INTO `language_settings` VALUES (16, 'tr', 'Turkish', 'disabled', NULL, NULL, 'tr');
INSERT INTO `language_settings` VALUES (17, 'zh-CN', 'Chinese (S)', 'disabled', NULL, NULL, 'cn');
INSERT INTO `language_settings` VALUES (18, 'zh-TW', 'Chinese (T)', 'disabled', NULL, NULL, 'cn');

-- ----------------------------
-- Table structure for lead_agents
-- ----------------------------
CREATE TABLE `lead_agents`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `status` enum('enabled','disabled') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'enabled',
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `lead_agents_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `lead_agents_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `lead_agents_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `lead_agents_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `lead_agents_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `lead_agents_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `lead_agents_ibfk_3` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `lead_agents_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of lead_agents
-- ----------------------------

-- ----------------------------
-- Table structure for lead_category
-- ----------------------------
CREATE TABLE `lead_category`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `category_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `lead_category_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `lead_category_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `lead_category_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `lead_category_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `lead_category_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `lead_category_ibfk_3` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of lead_category
-- ----------------------------

-- ----------------------------
-- Table structure for lead_custom_forms
-- ----------------------------
CREATE TABLE `lead_custom_forms`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `custom_fields_id` int UNSIGNED NULL DEFAULT NULL,
  `field_display_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `field_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `field_order` int NOT NULL,
  `status` enum('active','inactive') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active',
  `required` tinyint(1) NOT NULL DEFAULT 0,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `lead_custom_forms_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `lead_custom_forms_custom_fields_id_foreign`(`custom_fields_id` ASC) USING BTREE,
  INDEX `lead_custom_forms_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `lead_custom_forms_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `lead_custom_forms_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `lead_custom_forms_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `lead_custom_forms_ibfk_3` FOREIGN KEY (`custom_fields_id`) REFERENCES `custom_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `lead_custom_forms_ibfk_4` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of lead_custom_forms
-- ----------------------------
INSERT INTO `lead_custom_forms` VALUES (1, 1, NULL, 'Name', 'name', 1, 'active', 1, NULL, NULL, NULL, NULL);
INSERT INTO `lead_custom_forms` VALUES (2, 1, NULL, 'Email', 'email', 2, 'active', 0, NULL, NULL, NULL, NULL);
INSERT INTO `lead_custom_forms` VALUES (3, 1, NULL, 'Company Name', 'company_name', 3, 'active', 0, NULL, NULL, NULL, NULL);
INSERT INTO `lead_custom_forms` VALUES (4, 1, NULL, 'Website', 'website', 4, 'active', 0, NULL, NULL, NULL, NULL);
INSERT INTO `lead_custom_forms` VALUES (5, 1, NULL, 'Address', 'address', 5, 'active', 0, NULL, NULL, NULL, NULL);
INSERT INTO `lead_custom_forms` VALUES (6, 1, NULL, 'Mobile', 'mobile', 6, 'active', 0, NULL, NULL, NULL, NULL);
INSERT INTO `lead_custom_forms` VALUES (7, 1, NULL, 'Message', 'message', 7, 'active', 0, NULL, NULL, NULL, NULL);
INSERT INTO `lead_custom_forms` VALUES (8, 1, NULL, 'City', 'city', 1, 'active', 0, NULL, NULL, NULL, NULL);
INSERT INTO `lead_custom_forms` VALUES (9, 1, NULL, 'State', 'state', 2, 'active', 0, NULL, NULL, NULL, NULL);
INSERT INTO `lead_custom_forms` VALUES (10, 1, NULL, 'Country', 'country', 3, 'active', 0, NULL, NULL, NULL, NULL);
INSERT INTO `lead_custom_forms` VALUES (11, 1, NULL, 'Postal Code', 'postal_code', 4, 'active', 0, NULL, NULL, NULL, NULL);
INSERT INTO `lead_custom_forms` VALUES (12, 1, NULL, 'Source', 'source', 8, 'active', 0, NULL, NULL, NULL, NULL);
INSERT INTO `lead_custom_forms` VALUES (13, 1, NULL, 'Product', 'product', 9, 'active', 0, NULL, NULL, NULL, NULL);

-- ----------------------------
-- Table structure for lead_files
-- ----------------------------
CREATE TABLE `lead_files`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `lead_id` int UNSIGNED NOT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `filename` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `hashname` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `size` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `google_url` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `dropbox_link` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `lead_files_lead_id_foreign`(`lead_id` ASC) USING BTREE,
  INDEX `lead_files_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `lead_files_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `lead_files_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `lead_files_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `lead_files_ibfk_2` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `lead_files_ibfk_3` FOREIGN KEY (`lead_id`) REFERENCES `leads` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `lead_files_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of lead_files
-- ----------------------------

-- ----------------------------
-- Table structure for lead_follow_up
-- ----------------------------
CREATE TABLE `lead_follow_up`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `lead_id` int UNSIGNED NOT NULL,
  `remark` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `next_follow_up_date` datetime NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `event_id` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `send_reminder` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT 'no',
  `remind_time` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `remind_type` enum('minute','hour','day') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `status` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `lead_follow_up_lead_id_foreign`(`lead_id` ASC) USING BTREE,
  INDEX `lead_follow_up_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `lead_follow_up_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `lead_follow_up_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `lead_follow_up_ibfk_2` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `lead_follow_up_ibfk_3` FOREIGN KEY (`lead_id`) REFERENCES `leads` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of lead_follow_up
-- ----------------------------

-- ----------------------------
-- Table structure for lead_notes
-- ----------------------------
CREATE TABLE `lead_notes`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `lead_id` int UNSIGNED NULL DEFAULT NULL,
  `title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` tinyint(1) NOT NULL DEFAULT 0,
  `member_id` int UNSIGNED NULL DEFAULT NULL,
  `is_lead_show` tinyint(1) NOT NULL DEFAULT 0,
  `ask_password` tinyint(1) NOT NULL DEFAULT 0,
  `details` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `lead_notes_lead_id_foreign`(`lead_id` ASC) USING BTREE,
  INDEX `lead_notes_member_id_foreign`(`member_id` ASC) USING BTREE,
  INDEX `lead_notes_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `lead_notes_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `lead_notes_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `lead_notes_ibfk_2` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `lead_notes_ibfk_3` FOREIGN KEY (`lead_id`) REFERENCES `leads` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `lead_notes_ibfk_4` FOREIGN KEY (`member_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of lead_notes
-- ----------------------------

-- ----------------------------
-- Table structure for lead_products
-- ----------------------------
CREATE TABLE `lead_products`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `lead_id` int UNSIGNED NOT NULL,
  `product_id` int UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `lead_products_lead_id_foreign`(`lead_id` ASC) USING BTREE,
  INDEX `lead_products_product_id_foreign`(`product_id` ASC) USING BTREE,
  CONSTRAINT `lead_products_ibfk_1` FOREIGN KEY (`lead_id`) REFERENCES `leads` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `lead_products_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of lead_products
-- ----------------------------

-- ----------------------------
-- Table structure for lead_sources
-- ----------------------------
CREATE TABLE `lead_sources`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `type` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `lead_sources_type_company_id_unique`(`type` ASC, `company_id` ASC) USING BTREE,
  INDEX `lead_sources_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `lead_sources_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `lead_sources_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `lead_sources_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `lead_sources_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `lead_sources_ibfk_3` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of lead_sources
-- ----------------------------
INSERT INTO `lead_sources` VALUES (1, 1, 'email', NULL, NULL, NULL, NULL);
INSERT INTO `lead_sources` VALUES (2, 1, 'google', NULL, NULL, NULL, NULL);
INSERT INTO `lead_sources` VALUES (3, 1, 'facebook', NULL, NULL, NULL, NULL);
INSERT INTO `lead_sources` VALUES (4, 1, 'friend', NULL, NULL, NULL, NULL);
INSERT INTO `lead_sources` VALUES (5, 1, 'direct visit', NULL, NULL, NULL, NULL);
INSERT INTO `lead_sources` VALUES (6, 1, 'tv ad', NULL, NULL, NULL, NULL);

-- ----------------------------
-- Table structure for lead_status
-- ----------------------------
CREATE TABLE `lead_status`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `type` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `priority` int NOT NULL,
  `default` tinyint(1) NOT NULL,
  `label_color` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#ff0000',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `lead_status_type_company_id_unique`(`type` ASC, `company_id` ASC) USING BTREE,
  INDEX `lead_status_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `lead_status_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of lead_status
-- ----------------------------
INSERT INTO `lead_status` VALUES (1, 1, 'pending', 1, 1, '#FFE700', NULL, NULL);
INSERT INTO `lead_status` VALUES (2, 1, 'in process', 2, 0, '#009EFF', NULL, NULL);
INSERT INTO `lead_status` VALUES (3, 1, 'done', 3, 0, '#1FAE07', NULL, NULL);

-- ----------------------------
-- Table structure for lead_user_notes
-- ----------------------------
CREATE TABLE `lead_user_notes`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` int UNSIGNED NOT NULL,
  `lead_note_id` int UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `lead_user_notes_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `lead_user_notes_lead_note_id_foreign`(`lead_note_id` ASC) USING BTREE,
  CONSTRAINT `lead_user_notes_ibfk_1` FOREIGN KEY (`lead_note_id`) REFERENCES `lead_notes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `lead_user_notes_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of lead_user_notes
-- ----------------------------

-- ----------------------------
-- Table structure for leads
-- ----------------------------
CREATE TABLE `leads`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `client_id` int NULL DEFAULT NULL,
  `source_id` int NULL DEFAULT NULL,
  `status_id` int NULL DEFAULT NULL,
  `column_priority` int NOT NULL,
  `agent_id` bigint UNSIGNED NULL DEFAULT NULL,
  `company_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `website` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `address` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `salutation` enum('mr','mrs','miss','dr','sir','madam') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `client_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `client_email` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `mobile` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `cell` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `office` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `city` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `state` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `country` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `postal_code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `next_follow_up` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'yes',
  `value` double NULL DEFAULT 0,
  `currency_id` int UNSIGNED NULL DEFAULT NULL,
  `category_id` int UNSIGNED NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `hash` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `leads_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `leads_agent_id_foreign`(`agent_id` ASC) USING BTREE,
  INDEX `leads_currency_id_foreign`(`currency_id` ASC) USING BTREE,
  INDEX `leads_category_id_foreign`(`category_id` ASC) USING BTREE,
  INDEX `leads_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `leads_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `leads_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `leads_ibfk_2` FOREIGN KEY (`agent_id`) REFERENCES `lead_agents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `leads_ibfk_3` FOREIGN KEY (`category_id`) REFERENCES `lead_category` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `leads_ibfk_4` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `leads_ibfk_5` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `leads_ibfk_6` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of leads
-- ----------------------------

-- ----------------------------
-- Table structure for leave_files
-- ----------------------------
CREATE TABLE `leave_files`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `user_id` int UNSIGNED NOT NULL,
  `leave_id` int UNSIGNED NOT NULL,
  `filename` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `hashname` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `size` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `added_by` int UNSIGNED NULL DEFAULT NULL,
  `last_updated_by` int UNSIGNED NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `leave_files_company_id_foreign`(`company_id` ASC) USING BTREE,
  INDEX `leave_files_user_id_foreign`(`user_id` ASC) USING BTREE,
  INDEX `leave_files_leave_id_foreign`(`leave_id` ASC) USING BTREE,
  INDEX `leave_files_added_by_foreign`(`added_by` ASC) USING BTREE,
  INDEX `leave_files_last_updated_by_foreign`(`last_updated_by` ASC) USING BTREE,
  CONSTRAINT `leave_files_ibfk_1` FOREIGN KEY (`added_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `leave_files_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `leave_files_ibfk_3` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `leave_files_ibfk_4` FOREIGN KEY (`leave_id`) REFERENCES `leaves` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `leave_files_ibfk_5` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of leave_files
-- ----------------------------

-- ----------------------------
-- Table structure for leave_settings
-- ----------------------------
CREATE TABLE `leave_settings`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `company_id` int UNSIGNED NULL DEFAULT NULL,
  `manager_permission` enum('pre-approve','approved','cannot-approve') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pre-approve',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `leave_settings_company_id_foreign`(`company_id` ASC) USING BTREE,
  CONSTRAINT `leave_settings_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of leave_settings
-- ----------------------------
INSERT INTO `leave_settings` VALUES (1, 1, 'pre-approve', '2023-06-19 19:34:17', '2023-06-19 19:34:17');

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