-- Table structure for table `oauth_auth_codes`
--

CREATE TABLE `oauth_auth_codes` (
  `id` varchar(100) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `client_id` int(10) UNSIGNED NOT NULL,
  `scopes` text DEFAULT NULL,
  `revoked` tinyint(1) NOT NULL,
  `expires_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `oauth_personal_access_clients`
--

CREATE TABLE `oauth_personal_access_clients` (
  `id` int(10) UNSIGNED NOT NULL,
  `client_id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `packages`
--

CREATE TABLE `packages` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `description` text NOT NULL,
  `location_count` int(11) NOT NULL COMMENT 'No. of Business Locations, 0 = infinite option.',
  `user_count` int(11) NOT NULL,
  `product_count` int(11) NOT NULL,
  `bookings` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Enable/Disable bookings',
  `kitchen` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Enable/Disable kitchen',
  `order_screen` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Enable/Disable order_screen',
  `tables` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Enable/Disable tables',
  `invoice_count` int(11) NOT NULL,
  `interval` enum('days','months','years') NOT NULL,
  `interval_count` int(11) NOT NULL,
  `trial_days` int(11) NOT NULL,
  `price` decimal(22,4) NOT NULL,
  `custom_permissions` longtext NOT NULL,
  `created_by` int(11) NOT NULL,
  `sort_order` int(11) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL,
  `mark_package_as_popular` tinyint(1) NOT NULL,
  `businesses` longtext DEFAULT NULL,
  `is_private` tinyint(1) NOT NULL DEFAULT 0,
  `is_one_time` tinyint(1) NOT NULL DEFAULT 0,
  `enable_custom_link` tinyint(1) NOT NULL DEFAULT 0,
  `custom_link` varchar(191) DEFAULT NULL,
  `custom_link_text` varchar(191) DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `permissions`
--

CREATE TABLE `permissions` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `guard_name` varchar(191) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `permissions`
--

INSERT INTO `permissions` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES
(1, 'profit_loss_report.view', 'web', '2024-10-25 16:35:19', NULL),
(2, 'direct_sell.access', 'web', '2024-10-25 16:35:19', NULL),
(3, 'product.opening_stock', 'web', '2024-10-25 16:35:22', '2024-10-25 16:35:22'),
(4, 'crud_all_bookings', 'web', '2024-10-25 16:35:23', '2024-10-25 16:35:23'),
(5, 'crud_own_bookings', 'web', '2024-10-25 16:35:23', '2024-10-25 16:35:23'),
(6, 'access_default_selling_price', 'web', '2024-10-25 16:35:24', '2024-10-25 16:35:24'),
(7, 'purchase.payments', 'web', '2024-10-25 16:35:24', '2024-10-25 16:35:24'),
(8, 'sell.payments', 'web', '2024-10-25 16:35:24', '2024-10-25 16:35:24'),
(9, 'edit_product_price_from_sale_screen', 'web', '2024-10-25 16:35:25', '2024-10-25 16:35:25'),
(10, 'edit_product_discount_from_sale_screen', 'web', '2024-10-25 16:35:25', '2024-10-25 16:35:25'),
(11, 'roles.view', 'web', '2024-10-25 16:35:25', '2024-10-25 16:35:25'),
(12, 'roles.create', 'web', '2024-10-25 16:35:25', '2024-10-25 16:35:25'),
(13, 'roles.update', 'web', '2024-10-25 16:35:25', '2024-10-25 16:35:25'),
(14, 'roles.delete', 'web', '2024-10-25 16:35:25', '2024-10-25 16:35:25'),
(15, 'account.access', 'web', '2024-10-25 16:35:25', '2024-10-25 16:35:25'),
(16, 'discount.access', 'web', '2024-10-25 16:35:26', '2024-10-25 16:35:26'),
(17, 'view_purchase_price', 'web', '2024-10-25 16:35:26', '2024-10-25 16:35:26'),
(18, 'view_own_sell_only', 'web', '2024-10-25 16:35:26', '2024-10-25 16:35:26'),
(19, 'edit_product_discount_from_pos_screen', 'web', '2024-10-25 16:35:27', '2024-10-25 16:35:27'),
(20, 'edit_product_price_from_pos_screen', 'web', '2024-10-25 16:35:27', '2024-10-25 16:35:27'),
(21, 'access_shipping', 'web', '2024-10-25 16:35:28', '2024-10-25 16:35:28'),
(22, 'purchase.update_status', 'web', '2024-10-25 16:35:28', '2024-10-25 16:35:28'),
(23, 'list_drafts', 'web', '2024-10-25 16:35:29', '2024-10-25 16:35:29'),
(24, 'list_quotations', 'web', '2024-10-25 16:35:29', '2024-10-25 16:35:29'),
(25, 'view_cash_register', 'web', '2024-10-25 16:35:31', '2024-10-25 16:35:31'),
(26, 'close_cash_register', 'web', '2024-10-25 16:35:31', '2024-10-25 16:35:31'),
(27, 'print_invoice', 'web', '2024-10-25 16:35:33', '2024-10-25 16:35:33'),
(28, 'user.view', 'web', '2024-10-25 16:35:35', NULL),
(29, 'user.create', 'web', '2024-10-25 16:35:35', NULL),
(30, 'user.update', 'web', '2024-10-25 16:35:35', NULL),
(31, 'user.delete', 'web', '2024-10-25 16:35:35', NULL),
(32, 'supplier.view', 'web', '2024-10-25 16:35:35', NULL),
(33, 'supplier.create', 'web', '2024-10-25 16:35:35', NULL),
(34, 'supplier.update', 'web', '2024-10-25 16:35:35', NULL),
(35, 'supplier.delete', 'web', '2024-10-25 16:35:35', NULL),
(36, 'customer.view', 'web', '2024-10-25 16:35:35', NULL),
(37, 'customer.create', 'web', '2024-10-25 16:35:35', NULL),
(38, 'customer.update', 'web', '2024-10-25 16:35:35', NULL),
(39, 'customer.delete', 'web', '2024-10-25 16:35:35', NULL),
(40, 'product.view', 'web', '2024-10-25 16:35:35', NULL),
(41, 'product.create', 'web', '2024-10-25 16:35:35', NULL),
(42, 'product.update', 'web', '2024-10-25 16:35:35', NULL),
(43, 'product.delete', 'web', '2024-10-25 16:35:35', NULL),
(44, 'purchase.view', 'web', '2024-10-25 16:35:35', NULL),
(45, 'purchase.create', 'web', '2024-10-25 16:35:35', NULL),
(46, 'purchase.update', 'web', '2024-10-25 16:35:35', NULL),
(47, 'purchase.delete', 'web', '2024-10-25 16:35:35', NULL),
(48, 'sell.view', 'web', '2024-10-25 16:35:35', NULL),
(49, 'sell.create', 'web', '2024-10-25 16:35:35', NULL),
(50, 'sell.update', 'web', '2024-10-25 16:35:35', NULL),
(51, 'sell.delete', 'web', '2024-10-25 16:35:35', NULL),
(52, 'purchase_n_sell_report.view', 'web', '2024-10-25 16:35:35', NULL),
(53, 'contacts_report.view', 'web', '2024-10-25 16:35:35', NULL),
(54, 'stock_report.view', 'web', '2024-10-25 16:35:35', NULL),
(55, 'tax_report.view', 'web', '2024-10-25 16:35:35', NULL),
(56, 'trending_product_report.view', 'web', '2024-10-25 16:35:35', NULL),
(57, 'register_report.view', 'web', '2024-10-25 16:35:35', NULL),
(58, 'sales_representative.view', 'web', '2024-10-25 16:35:35', NULL),
(59, 'expense_report.view', 'web', '2024-10-25 16:35:35', NULL),
(60, 'business_settings.access', 'web', '2024-10-25 16:35:35', NULL),
(61, 'barcode_settings.access', 'web', '2024-10-25 16:35:35', NULL),
(62, 'invoice_settings.access', 'web', '2024-10-25 16:35:35', NULL),
(63, 'brand.view', 'web', '2024-10-25 16:35:35', NULL),
(64, 'brand.create', 'web', '2024-10-25 16:35:35', NULL),
(65, 'brand.update', 'web', '2024-10-25 16:35:35', NULL),
(66, 'brand.delete', 'web', '2024-10-25 16:35:35', NULL),
(67, 'tax_rate.view', 'web', '2024-10-25 16:35:35', NULL),
(68, 'tax_rate.create', 'web', '2024-10-25 16:35:35', NULL),
(69, 'tax_rate.update', 'web', '2024-10-25 16:35:35', NULL),
(70, 'tax_rate.delete', 'web', '2024-10-25 16:35:35', NULL),
(71, 'unit.view', 'web', '2024-10-25 16:35:35', NULL),
(72, 'unit.create', 'web', '2024-10-25 16:35:35', NULL),
(73, 'unit.update', 'web', '2024-10-25 16:35:35', NULL),
(74, 'unit.delete', 'web', '2024-10-25 16:35:35', NULL),
(75, 'category.view', 'web', '2024-10-25 16:35:35', NULL),
(76, 'category.create', 'web', '2024-10-25 16:35:35', NULL),
(77, 'category.update', 'web', '2024-10-25 16:35:35', NULL),
(78, 'category.delete', 'web', '2024-10-25 16:35:35', NULL),
(79, 'expense.access', 'web', '2024-10-25 16:35:35', NULL),
(80, 'access_all_locations', 'web', '2024-10-25 16:35:35', NULL),
(81, 'dashboard.data', 'web', '2024-10-25 16:35:35', NULL),
(82, 'location.1', 'web', '2024-10-25 16:39:24', '2024-10-25 16:39:24'),
(83, 'location.2', 'web', '2024-10-29 03:26:47', '2024-10-29 03:26:47'),
(84, 'essentials.create_message', 'web', '2024-11-03 04:26:40', '2024-11-03 04:26:40'),
(85, 'essentials.view_message', 'web', '2024-11-03 04:26:40', '2024-11-03 04:26:40'),
(86, 'manufacturing.access_recipe', 'web', '2024-11-03 04:26:41', '2024-11-03 04:26:41'),
(87, 'manufacturing.access_production', 'web', '2024-11-03 04:26:41', '2024-11-03 04:26:41'),
(88, 'manufacturing.add_recipe', 'web', '2024-11-03 04:26:41', '2024-11-03 04:26:41'),
(89, 'manufacturing.edit_recipe', 'web', '2024-11-03 04:26:41', '2024-11-03 04:26:41'),
(90, 'essentials.approve_leave', 'web', '2024-11-03 04:26:41', '2024-11-03 04:26:41'),
(91, 'essentials.assign_todos', 'web', '2024-11-03 04:26:41', '2024-11-03 04:26:41'),
(92, 'essentials.add_allowance_and_deduction', 'web', '2024-11-03 04:26:41', '2024-11-03 04:26:41'),
(93, 'selling_price_group.1', 'web', '2024-11-03 04:45:06', '2024-11-03 04:45:06'),
(94, 'selling_price_group.2', 'web', '2024-11-03 05:29:42', '2024-11-03 05:29:42'),
(95, 'poscustom.enabled', 'web', '2025-02-01 18:52:33', '2025-02-01 18:52:33'),
(96, 'project.create_project', 'web', '2025-02-01 18:59:09', '2025-02-01 18:59:09'),
(97, 'project.edit_project', 'web', '2025-02-01 18:59:09', '2025-02-01 18:59:09'),
(98, 'project.delete_project', 'web', '2025-02-01 18:59:09', '2025-02-01 18:59:09'),
(99, 'woocommerce.syc_categories', 'web', '2025-02-01 19:14:36', '2025-02-01 19:14:36'),
(100, 'woocommerce.sync_products', 'web', '2025-02-01 19:14:36', '2025-02-01 19:14:36'),
(101, 'woocommerce.sync_orders', 'web', '2025-02-01 19:14:36', '2025-02-01 19:14:36'),
(102, 'woocommerce.map_tax_rates', 'web', '2025-02-01 19:14:36', '2025-02-01 19:14:36'),
(103, 'woocommerce.access_woocommerce_api_settings', 'web', '2025-02-01 19:14:36', '2025-02-01 19:14:36'),
(104, 'repair.create', 'web', '2025-02-01 19:15:01', '2025-02-01 19:15:01'),
(105, 'repair.update', 'web', '2025-02-01 19:15:01', '2025-02-01 19:15:01'),
(106, 'repair.view', 'web', '2025-02-01 19:15:01', '2025-02-01 19:15:01'),
(107, 'repair.delete', 'web', '2025-02-01 19:15:01', '2025-02-01 19:15:01'),
(108, 'repair_status.update', 'web', '2025-02-01 19:15:01', '2025-02-01 19:15:01'),
(109, 'repair_status.access', 'web', '2025-02-01 19:15:01', '2025-02-01 19:15:01'),
(110, 'location.3', 'web', '2025-02-14 18:51:43', '2025-02-14 18:51:43'),
(111, 'selling_price_group.3', 'web', '2025-02-14 17:35:16', '2025-02-14 17:35:16'),
(112, 'location.4', 'web', '2025-02-17 06:46:51', '2025-02-17 06:46:51'),
(113, 'view_export_buttons', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(114, 'edit_purchase_payment', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(115, 'edit_pos_payment', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(116, 'view_paid_sells_only', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(117, 'view_due_sells_only', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(118, 'view_partial_sells_only', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(119, 'view_overdue_sells_only', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(120, 'direct_sell.update', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(121, 'view_commission_agent_sell', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(122, 'edit_sell_payment', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(123, 'access_sell_return', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(124, 'access_own_sell_return', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(125, 'edit_invoice_number', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(126, 'draft.update', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(127, 'draft.delete', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(128, 'quotation.update', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(129, 'quotation.delete', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(130, 'access_pending_shipments_only', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(131, 'access_commission_agent_shipping', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(132, 'expense.add', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(133, 'expense.edit', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(134, 'customer.view_own', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(135, 'customer_irrespective_of_sell', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(136, 'draft.view_own', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(137, 'quotation.view_own', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(138, 'access_own_shipping', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(139, 'view_own_expense', 'web', '2025-02-17 05:50:49', '2025-02-17 05:50:49'),
(140, 'selling_price_group.4', 'web', '2025-02-17 06:00:27', '2025-02-17 06:00:27'),
(141, 'selling_price_group.5', 'web', '2025-02-17 06:02:07', '2025-02-17 06:02:07'),
(142, 'selling_price_group.6', 'web', '2025-02-17 06:03:35', '2025-02-17 06:03:35'),
(143, 'location.5', 'web', '2025-02-23 06:21:29', '2025-02-23 06:21:29'),
(144, 'view_product_stock_value', 'web', '2025-02-24 06:58:23', '2025-02-24 06:58:23'),
(145, 'access_printers', 'web', '2025-02-24 06:58:23', '2025-02-24 06:58:23'),
(146, 'edit_account_transaction', 'web', '2025-02-24 06:58:23', '2025-02-24 06:58:23'),
(147, 'inventorymanagement.view', 'web', '2025-02-24 06:58:23', '2025-02-24 06:58:23'),
(148, 'inventorymanagement.empty', 'web', '2025-02-24 06:58:23', '2025-02-24 06:58:23'),
(149, 'disable_pay_checkout', 'web', '2025-02-24 09:34:06', '2025-02-24 09:34:06'),
(150, 'disable_draft', 'web', '2025-02-24 09:34:06', '2025-02-24 09:34:06'),
(151, 'disable_express_checkout', 'web', '2025-02-24 09:34:06', '2025-02-24 09:34:06'),
(152, 'disable_discount', 'web', '2025-02-24 09:34:06', '2025-02-24 09:34:06'),
(153, 'disable_suspend_sale', 'web', '2025-02-24 09:34:06', '2025-02-24 09:34:06'),
(154, 'disable_credit_sale', 'web', '2025-02-24 09:34:06', '2025-02-24 09:34:06'),
(155, 'disable_quotation', 'web', '2025-02-24 09:34:06', '2025-02-24 09:34:06'),
(156, 'disable_card', 'web', '2025-02-24 09:34:06', '2025-02-24 09:34:06'),
(157, 'expense.delete', 'web', '2025-02-24 09:34:06', '2025-02-24 09:34:06'),
(158, 'supplier.view_own', 'web', '2025-02-24 09:34:06', '2025-02-24 09:34:06'),
(159, 'view_own_purchase', 'web', '2025-02-24 09:34:06', '2025-02-24 09:34:06'),
(160, 'purchase_requisition.create', 'web', '2025-02-24 09:42:54', '2025-02-24 09:42:54'),
(161, 'purchase_requisition.delete', 'web', '2025-02-24 09:42:54', '2025-02-24 09:42:54'),
(162, 'purchase_order.create', 'web', '2025-02-24 09:42:54', '2025-02-24 09:42:54'),
(163, 'purchase_order.update', 'web', '2025-02-24 09:42:54', '2025-02-24 09:42:54'),
(164, 'purchase_order.delete', 'web', '2025-02-24 09:42:54', '2025-02-24 09:42:54'),
(165, 'purchase_requisition.view_own', 'web', '2025-02-24 09:42:54', '2025-02-24 09:42:54'),
(166, 'purchase_order.view_own', 'web', '2025-02-24 09:42:54', '2025-02-24 09:42:54'),
(167, 'location.6', 'web', '2025-03-09 21:45:09', '2025-03-09 21:45:09'),
(168, 'draft.view_all', 'web', '2025-03-12 18:48:09', '2025-03-12 18:48:09'),
(169, 'quotation.view_all', 'web', '2025-03-12 18:48:09', '2025-03-12 18:48:09'),
(170, 'selling_price_group.7', 'web', '2025-03-13 16:46:27', '2025-03-13 16:46:27'),
(171, 'location.7', 'web', '2025-03-21 14:09:02', '2025-03-21 14:09:02'),
(172, 'location.8', 'web', '2025-04-03 13:38:09', '2025-04-03 13:38:09'),
(173, 'location.9', 'web', '2025-04-25 19:07:48', '2025-04-25 19:07:48'),
(174, 'location.10', 'web', '2025-04-25 19:16:11', '2025-04-25 19:16:11'),
(175, 'selling_price_group.8', 'web', '2025-04-26 03:38:58', '2025-04-26 03:38:58'),
(176, 'selling_price_group.9', 'web', '2025-04-26 03:39:08', '2025-04-26 03:39:08'),
(177, 'selling_price_group.10', 'web', '2025-04-26 03:39:18', '2025-04-26 03:39:18'),
(178, 'selling_price_group.11', 'web', '2025-04-26 03:39:37', '2025-04-26 03:39:37'),
(179, 'selling_price_group.12', 'web', '2025-04-26 03:39:52', '2025-04-26 03:39:52'),
(180, 'selling_price_group.13', 'web', '2025-04-26 03:40:16', '2025-04-26 03:40:16'),
(181, 'selling_price_group.14', 'web', '2025-04-26 08:43:39', '2025-04-26 08:43:39'),
(182, 'location.11', 'web', '2025-04-29 06:08:51', '2025-04-29 06:08:51'),
(183, 'location.12', 'web', '2025-06-02 07:35:33', '2025-06-02 07:35:33'),
(184, 'location.13', 'web', '2025-06-08 19:48:05', '2025-06-08 19:48:05'),
(185, 'location.14', 'web', '2025-06-09 00:14:59', '2025-06-09 00:14:59'),
(186, 'location.15', 'web', '2025-07-14 07:24:17', '2025-07-14 07:24:17'),
(187, 'location.16', 'web', '2025-09-07 12:54:54', '2025-09-07 12:54:54'),
(188, 'AdvancedReports.view', 'web', '2025-11-10 15:15:20', '2025-11-10 15:15:20'),
(189, 'AdvancedReports.cash_flow_report', 'web', '2025-11-10 15:15:20', '2025-11-10 15:15:20'),
(190, 'AdvancedReports.purchase_analysis_report', 'web', '2025-11-10 15:15:20', '2025-11-10 15:15:20'),
(191, 'selling_price_group.15', 'web', '2026-01-10 08:03:00', '2026-01-10 08:03:00'),
(192, 'businessmanagement.view', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(193, 'businessmanagement.purchase_register', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(194, 'businessmanagement.sales_register', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(195, 'businessmanagement.stock_register', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(196, 'businessmanagement.accounts_register', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(197, 'businessmanagement.purchase_register.date_wise_purchase', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(198, 'businessmanagement.purchase_register.supplier_wise_purchase', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(199, 'businessmanagement.purchase_register.supplier_wise_purchase_wop', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(200, 'businessmanagement.purchase_register.product_wise_purchase', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(201, 'businessmanagement.purchase_register.product_wise_purchase_wop', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(202, 'businessmanagement.purchase_register.location_wise_net_product_purchase', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(203, 'businessmanagement.purchase_register.date_wise_net_product_purchase', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(204, 'businessmanagement.purchase_register.supplier_wise_statement', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(205, 'businessmanagement.purchase_register.supplier_and_product_wise_purchase', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(206, 'businessmanagement.purchase_register.purchased_product_movement', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(207, 'businessmanagement.purchase_register.supplier_wise_purchase_return', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(208, 'businessmanagement.purchase_register.date_wise_purchase_return', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(209, 'businessmanagement.purchase_register.product_wise_purchase_return', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(210, 'businessmanagement.purchase_register.date_wise_purchase_order', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(211, 'businessmanagement.purchase_register.supplier_wise_purchase_order', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(212, 'businessmanagement.sales_register.date_wise_sales', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(213, 'businessmanagement.sales_register.product_wise_sales', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(214, 'businessmanagement.sales_register.customer_wise_sales', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(215, 'businessmanagement.sales_register.date_wise_net_product_sales', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(216, 'businessmanagement.sales_register.customer_wise_net_product_sales', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(217, 'businessmanagement.sales_register.date_wise_gross_profit', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(218, 'businessmanagement.sales_register.product_wise_gross_profit', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(219, 'businessmanagement.sales_register.date_wise_sales_return', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(220, 'businessmanagement.sales_register.product_wise_sales_return', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(221, 'businessmanagement.sales_register.customer_wise_sales_return', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(222, 'businessmanagement.sales_register.explicit_product_wise_sales', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(223, 'businessmanagement.sales_register.customer_wise_statement', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(224, 'businessmanagement.sales_register.product_group_wise_net_sales', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(225, 'businessmanagement.sales_register.product_wise_sales_summary', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(226, 'businessmanagement.sales_register.date_wise_sales_summary', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(227, 'businessmanagement.sales_register.product_group_wise_net_sales_mpo', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(228, 'businessmanagement.sales_register.customer_wise_sales_summary', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(229, 'businessmanagement.sales_register.customer_wise_invoice_status', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(230, 'businessmanagement.sales_register.date_wise_sales_invoice', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(231, 'businessmanagement.sales_register.customer_wise_gross_profit', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(232, 'businessmanagement.sales_register.product_wise_net_profit', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(233, 'businessmanagement.sales_register.customer_wise_sales_with_serial', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(234, 'businessmanagement.sales_register.product_wise_sales_with_serial', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(235, 'businessmanagement.sales_register.daily_sales_details', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(236, 'businessmanagement.stock_register.current_stock_combined', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(237, 'businessmanagement.stock_register.current_stock_c', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(238, 'businessmanagement.stock_register.current_stock_with_serial', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(239, 'businessmanagement.stock_register.combined_current_stock_all_br_summary', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(240, 'businessmanagement.stock_register.date_wise_product_status', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(241, 'businessmanagement.stock_register.date_wise_stock', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(242, 'businessmanagement.stock_register.product_price_list', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(243, 'businessmanagement.stock_register.supplier_wise_current_stock', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(244, 'businessmanagement.stock_register.date_wise_product_in_out_statement', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(245, 'businessmanagement.stock_register.date_wise_stock_serial_m', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(246, 'businessmanagement.accounts_register.due_list', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(247, 'businessmanagement.accounts_register.all_customers_due_list', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(248, 'businessmanagement.accounts_register.supplier_due_list', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(249, 'businessmanagement.accounts_register.customer_accounts_ledger', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(250, 'businessmanagement.accounts_register.cash_book', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(251, 'businessmanagement.accounts_register.date_wise_credit_voucher', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(252, 'businessmanagement.accounts_register.date_wise_debit_voucher', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(253, 'businessmanagement.accounts_register.income_statement', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(254, 'businessmanagement.accounts_register.day_book', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(255, 'businessmanagement.accounts_register.due_list_without_treatment', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(256, 'businessmanagement.accounts_register.date_wise_sales_received', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(257, 'businessmanagement.accounts_register.balance_sheet', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(258, 'businessmanagement.accounts_register.date_wise_general_expenses', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(259, 'businessmanagement.accounts_register.accounts_receivable', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(260, 'businessmanagement.accounts_register.accounts_payable', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(261, 'businessmanagement.accounts_register.customer_due_with_ageing', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(262, 'businessmanagement.accounts_register.cash_flows', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(263, 'businessmanagement.accounts_register.date_wise_receipt_payment_statement', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(264, 'businessmanagement.accounts_register.date_wise_receive', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(265, 'businessmanagement.accounts_register.date_wise_sales_with_profit', 'web', '2026-01-13 19:51:18', '2026-01-13 19:51:18'),
(266, 'businessmanagement.daybook.view', 'web', '2026-01-13 19:51:20', '2026-01-13 19:51:20'),
(267, 'businessmanagement.daybook.export', 'web', '2026-01-13 19:51:20', '2026-01-13 19:51:20'),
(268, 'accounting.view_all', 'web', '2026-01-13 20:14:08', '2026-01-13 20:14:08'),
(269, 'accounting.view_trial_balance', 'web', '2026-01-13 20:14:08', '2026-01-13 20:14:08'),
(270, 'accounting.view_balance_sheet', 'web', '2026-01-13 20:14:08', '2026-01-13 20:14:08'),
(271, 'accounting.view_pl', 'web', '2026-01-13 20:14:08', '2026-01-13 20:14:08'),
(272, 'accounting.view_cashflow', 'web', '2026-01-13 20:14:08', '2026-01-13 20:14:08'),
(273, 'accounting.view_ar', 'web', '2026-01-13 20:14:08', '2026-01-13 20:14:08'),
(274, 'accounting.view_ap', 'web', '2026-01-13 20:14:08', '2026-01-13 20:14:08'),
(275, 'accounting.view_daybook', 'web', '2026-01-13 20:14:08', '2026-01-13 20:14:08'),
(276, 'accounting.view_cashbook', 'web', '2026-01-13 20:14:08', '2026-01-13 20:14:08'),
(277, 'accounting.view_bankbook', 'web', '2026-01-13 20:14:08', '2026-01-13 20:14:08'),
(278, 'accounting.export_reports', 'web', '2026-01-13 20:14:08', '2026-01-13 20:14:08'),
(279, 'accounting.print_multi_account', 'web', '2026-01-13 20:14:08', '2026-01-13 20:14:08'),
(280, 'backup_management.create_backup', 'web', '2026-01-13 20:55:19', '2026-01-13 20:55:19'),
(281, 'backup_management.view_backup', 'web', '2026-01-13 20:55:19', '2026-01-13 20:55:19'),
(282, 'backup_management.download_backup', 'web', '2026-01-13 20:55:19', '2026-01-13 20:55:19'),
(283, 'backup_management.delete_backup', 'web', '2026-01-13 20:55:19', '2026-01-13 20:55:19'),
(284, 'backup_management.restore_backup', 'web', '2026-01-13 20:55:19', '2026-01-13 20:55:19'),
(285, 'location.17', 'web', '2026-01-24 11:38:53', '2026-01-24 11:38:53'),
(286, 'location.18', 'web', '2026-02-24 02:37:33', '2026-02-24 02:37:33'),
(287, 'accounting.view_journals', 'web', '2026-04-02 14:55:36', '2026-04-02 14:55:36'),
(288, 'delete_sell_payment', 'web', '2026-04-02 16:15:06', '2026-04-02 16:15:06'),
(289, 'AdvancedReports.export', 'web', '2026-04-02 16:15:06', '2026-04-02 16:15:06'),
(290, 'AdvancedReports.sales_report', 'web', '2026-04-02 16:15:06', '2026-04-02 16:15:06'),
(291, 'AdvancedReports.sales_detail_report', 'web', '2026-04-02 16:15:06', '2026-04-02 16:15:06'),
(292, 'AdvancedReports.customer_monthly_sales', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(293, 'AdvancedReports.itemwise_sales_report', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(294, 'AdvancedReports.daily_report', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(295, 'AdvancedReports.daily_summary_report', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(296, 'AdvancedReports.inventory_turnover', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(297, 'AdvancedReports.customer_lifetime_value', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(298, 'AdvancedReports.customer_behavior', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(299, 'AdvancedReports.customer_segmentation', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(300, 'AdvancedReports.gst_sales_report', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(301, 'AdvancedReports.gst_purchase_report', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(302, 'AdvancedReports.expense_monthly_report', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(303, 'AdvancedReports.operations_summary_report', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(304, 'AdvancedReports.customer_group_performance', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(305, 'dailystockhistory.view', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(306, 'dailystockhistory.access', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(307, 'daybook.view', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(308, 'daybook.export', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(309, 'essentials.crud_leave_type', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(310, 'essentials.allow_users_for_attendance_from_web', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(311, 'essentials.allow_users_for_attendance_from_api', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(312, 'essentials.view_allowance_and_deduction', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(313, 'essentials.crud_department', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(314, 'essentials.crud_designation', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(315, 'essentials.view_all_payroll', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(316, 'essentials.create_payroll', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(317, 'essentials.update_payroll', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(318, 'essentials.add_todos', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(319, 'essentials.edit_todos', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(320, 'essentials.access_sales_target', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(321, 'exchange.access', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(322, 'exchange.view', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(323, 'exchange.create', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(324, 'exchange.cancel', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(325, 'exchange.delete', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(326, 'exchange.export', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(327, 'exchange.print', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(328, 'rma.view', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(329, 'rma.complain_receive', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(330, 'rma.replace_out', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(331, 'rma.replace_in', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(332, 'rma.replacement_delivery', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(333, 'rma.diagnosis', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(334, 'rma.item_utilize', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(335, 'rma.problem_setup', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(336, 'rma.serial_history', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(337, 'rma.service_bill', 'web', '2026-04-02 16:15:07', '2026-04-02 16:15:07'),
(338, 'rma.engineer_fixing', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(339, 'rma.approve', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(340, 'job_sheet.create', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(341, 'job_sheet.edit', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(342, 'access.spreadsheet', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(343, 'create.spreadsheet', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(344, 'StockRecalculation.view', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(345, 'StockRecalculation.manage', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(346, 'StockRecalculation.backup', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(347, 'StockRecalculation.recalculate', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(348, 'StockRecalculation.audit', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(349, 'StockRecalculation.export', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(350, 'essentials.crud_own_leave', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(351, 'essentials.view_own_attendance', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(352, 'repair.view_own', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(353, 'job_sheet.view_all', 'web', '2026-04-02 16:15:08', '2026-04-02 16:15:08'),
(354, 'location.19', 'web', '2026-04-02 16:17:59', '2026-04-02 16:17:59');

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

--
-- Table structure for table `pjt_invoice_lines`
--

CREATE TABLE `pjt_invoice_lines` (
  `id` int(10) UNSIGNED NOT NULL,
  `transaction_id` int(10) UNSIGNED NOT NULL,
  `task` varchar(191) NOT NULL,
  `description` text DEFAULT NULL,
  `rate` decimal(22,4) NOT NULL,
  `tax_rate_id` int(11) DEFAULT NULL,
  `quantity` decimal(22,4) NOT NULL,
  `total` decimal(22,4) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `pjt_projects`
--

CREATE TABLE `pjt_projects` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_id` int(11) NOT NULL,
  `name` varchar(191) NOT NULL,
  `contact_id` int(11) DEFAULT NULL,
  `status` enum('not_started','in_progress','on_hold','cancelled','completed') NOT NULL,
  `lead_id` int(11) NOT NULL,
  `start_date` datetime DEFAULT NULL,
  `end_date` datetime DEFAULT NULL,
  `description` text DEFAULT NULL,
  `created_by` int(11) NOT NULL,
  `settings` text DEFAULT NULL,
  `custom_field1` varchar(191) DEFAULT NULL,
  `custom_field2` varchar(191) DEFAULT NULL,
  `custom_field3` varchar(191) DEFAULT NULL,
  `custom_field4` varchar(191) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `pjt_project_members`
--

CREATE TABLE `pjt_project_members` (
  `id` int(10) UNSIGNED NOT NULL,
  `project_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `pjt_project_tasks`
--

CREATE TABLE `pjt_project_tasks` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_id` int(11) NOT NULL,
  `project_id` int(10) UNSIGNED NOT NULL,
  `task_id` varchar(191) NOT NULL,
  `subject` varchar(191) NOT NULL,
  `start_date` datetime DEFAULT NULL,
  `due_date` datetime DEFAULT NULL,
  `priority` enum('low','medium','high','urgent') NOT NULL DEFAULT 'low',
  `description` text DEFAULT NULL,
  `created_by` int(11) NOT NULL,
  `status` enum('completed','not_started','in_progress','on_hold','cancelled') NOT NULL DEFAULT 'not_started',
  `custom_field_1` varchar(191) DEFAULT NULL,
  `custom_field_2` varchar(191) DEFAULT NULL,
  `custom_field_3` varchar(191) DEFAULT NULL,
  `custom_field_4` varchar(191) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `pjt_project_task_comments`
--

CREATE TABLE `pjt_project_task_comments` (
  `id` int(10) UNSIGNED NOT NULL,
  `project_task_id` int(10) UNSIGNED NOT NULL,
  `comment` text NOT NULL,
  `commented_by` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `pjt_project_task_members`
--

CREATE TABLE `pjt_project_task_members` (
  `id` int(10) UNSIGNED NOT NULL,
  `project_task_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `pjt_project_time_logs`
--

CREATE TABLE `pjt_project_time_logs` (
  `id` int(10) UNSIGNED NOT NULL,
  `project_id` int(10) UNSIGNED NOT NULL,
  `project_task_id` int(10) UNSIGNED DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `start_datetime` datetime NOT NULL,
  `end_datetime` datetime NOT NULL,
  `note` text DEFAULT NULL,
  `created_by` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `premade_lines`
--

CREATE TABLE `premade_lines` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `premade_product_id` int(10) UNSIGNED NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL,
  `variation_id` int(10) UNSIGNED NOT NULL,
  `sub_unit_id` int(11) DEFAULT NULL,
  `sell_unit_id` int(11) DEFAULT NULL,
  `quantity` decimal(22,4) NOT NULL,
  `premade_price` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `premade_price_inc_tax` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `printers`
--

CREATE TABLE `printers` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `category_id` int(11) DEFAULT NULL,
  `name` varchar(191) NOT NULL,
  `connection_type` enum('network','windows','linux') NOT NULL,
  `capability_profile` enum('default','simple','SP2000','TEP-200M','P822D') NOT NULL DEFAULT 'default',
  `char_per_line` varchar(191) DEFAULT NULL,
  `ip_address` varchar(191) DEFAULT NULL,
  `port` varchar(191) DEFAULT NULL,
  `path` varchar(191) DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

CREATE TABLE `products` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `type` enum('single','variable','modifier','combo') DEFAULT NULL,
  `unit_id` int(10) UNSIGNED DEFAULT NULL,
  `secondary_unit_id` int(11) DEFAULT NULL,
  `sub_unit_ids` text DEFAULT NULL,
  `brand_id` int(10) UNSIGNED DEFAULT NULL,
  `supplier_id` int(10) UNSIGNED DEFAULT NULL,
  `category_id` int(10) UNSIGNED DEFAULT NULL,
  `sub_category_id` int(10) UNSIGNED DEFAULT NULL,
  `discount_id` int(10) UNSIGNED DEFAULT NULL,
  `tax` int(10) UNSIGNED DEFAULT NULL,
  `tax_type` enum('inclusive','exclusive') NOT NULL,
  `enable_stock` tinyint(1) NOT NULL DEFAULT 0,
  `alert_quantity` decimal(22,4) DEFAULT NULL,
  `sku` varchar(191) NOT NULL,
  `barcode_type` enum('C39','C128','EAN13','EAN8','UPCA','UPCE') DEFAULT 'C128',
  `expiry_period` decimal(4,2) DEFAULT NULL,
  `expiry_period_type` enum('days','months') DEFAULT NULL,
  `enable_sr_no` tinyint(1) NOT NULL DEFAULT 0,
  `enable_serial_number` tinyint(1) NOT NULL DEFAULT 0,
  `weight` varchar(191) DEFAULT NULL,
  `pre_made` tinyint(4) NOT NULL DEFAULT 0,
  `use_multi_unit` tinyint(1) NOT NULL DEFAULT 0,
  `first_conversion_unit_id` int(10) UNSIGNED DEFAULT NULL,
  `first_conversion_unit_rate` decimal(20,4) DEFAULT NULL,
  `second_conversion_unit_id` int(10) UNSIGNED DEFAULT NULL,
  `second_conversion_unit_rate` decimal(20,4) DEFAULT NULL,
  `product_custom_field1` varchar(191) DEFAULT NULL,
  `product_custom_field2` varchar(191) DEFAULT NULL,
  `product_custom_field3` varchar(191) DEFAULT NULL,
  `product_custom_field4` varchar(191) DEFAULT NULL,
  `product_custom_field5` varchar(191) DEFAULT NULL,
  `product_custom_field6` varchar(191) DEFAULT NULL,
  `product_custom_field7` varchar(191) DEFAULT NULL,
  `product_custom_field8` varchar(191) DEFAULT NULL,
  `product_custom_field9` varchar(191) DEFAULT NULL,
  `product_custom_field10` varchar(191) DEFAULT NULL,
  `product_custom_field11` varchar(191) DEFAULT NULL,
  `product_custom_field12` varchar(191) DEFAULT NULL,
  `product_custom_field13` varchar(191) DEFAULT NULL,
  `product_custom_field14` varchar(191) DEFAULT NULL,
  `product_custom_field15` varchar(191) DEFAULT NULL,
  `product_custom_field16` varchar(191) DEFAULT NULL,
  `product_custom_field17` varchar(191) DEFAULT NULL,
  `product_custom_field18` varchar(191) DEFAULT NULL,
  `product_custom_field19` varchar(191) DEFAULT NULL,
  `product_custom_field20` varchar(191) DEFAULT NULL,
  `image` varchar(191) DEFAULT NULL,
  `woocommerce_media_id` int(11) DEFAULT NULL,
  `product_description` text DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `woocommerce_product_id` int(11) DEFAULT NULL,
  `woocommerce_disable_sync` tinyint(1) NOT NULL DEFAULT 0,
  `preparation_time_in_minutes` int(11) DEFAULT NULL,
  `warranty_id` int(11) DEFAULT NULL,
  `is_inactive` tinyint(1) NOT NULL DEFAULT 0,
  `repair_model_id` int(10) UNSIGNED DEFAULT NULL,
  `not_for_selling` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `status_modifier` enum('enabled','disabled') DEFAULT 'enabled'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `products`
--

INSERT INTO `products` (`id`, `name`, `business_id`, `type`, `unit_id`, `secondary_unit_id`, `sub_unit_ids`, `brand_id`, `supplier_id`, `category_id`, `sub_category_id`, `discount_id`, `tax`, `tax_type`, `enable_stock`, `alert_quantity`, `sku`, `barcode_type`, `expiry_period`, `expiry_period_type`, `enable_sr_no`, `enable_serial_number`, `weight`, `pre_made`, `use_multi_unit`, `first_conversion_unit_id`, `first_conversion_unit_rate`, `second_conversion_unit_id`, `second_conversion_unit_rate`, `product_custom_field1`, `product_custom_field2`, `product_custom_field3`, `product_custom_field4`, `product_custom_field5`, `product_custom_field6`, `product_custom_field7`, `product_custom_field8`, `product_custom_field9`, `product_custom_field10`, `product_custom_field11`, `product_custom_field12`, `product_custom_field13`, `product_custom_field14`, `product_custom_field15`, `product_custom_field16`, `product_custom_field17`, `product_custom_field18`, `product_custom_field19`, `product_custom_field20`, `image`, `woocommerce_media_id`, `product_description`, `created_by`, `woocommerce_product_id`, `woocommerce_disable_sync`, `preparation_time_in_minutes`, `warranty_id`, `is_inactive`, `repair_model_id`, `not_for_selling`, `created_at`, `updated_at`, `status_modifier`) VALUES
(2216, 'Lux Small Rose', 1, 'single', 1, NULL, NULL, 145, NULL, 410, NULL, 0, NULL, 'exclusive', 1, 10.0000, '123', 'C128', NULL, NULL, 0, 0, NULL, 0, 0, NULL, NULL, NULL, NULL, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1775152503_FlyerDesign29july(1).jpg', NULL, NULL, 1, NULL, 0, NULL, NULL, 0, NULL, 0, '2026-04-02 17:53:21', '2026-04-02 17:55:03', 'enabled'),
(2217, 'Samsung A123', 1, 'single', 1, NULL, NULL, 148, NULL, 414, NULL, 0, NULL, 'exclusive', 1, 5.0000, 's1', 'C128', NULL, NULL, 1, 1, NULL, 0, 0, NULL, NULL, NULL, NULL, '0', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1775152855_R3.jpg', NULL, NULL, 1, NULL, 0, NULL, 24, 0, NULL, 0, '2026-04-02 17:58:42', '2026-04-02 18:00:55', 'enabled'),
(2218, 'iphone 17', 1, 'single', 1, NULL, NULL, 149, NULL, 414, NULL, NULL, NULL, 'exclusive', 1, 3.0000, 'iphone17', 'C128', NULL, NULL, 1, 1, NULL, 0, 0, NULL, NULL, NULL, NULL, '0', '9', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, 0, NULL, 25, 0, NULL, 0, '2026-04-02 18:03:14', '2026-04-02 18:03:14', 'enabled'),
(2219, 'Lux Big Rose', 1, 'single', 1, NULL, NULL, 145, NULL, 410, NULL, NULL, NULL, 'exclusive', 1, NULL, 'LX12', 'C128', NULL, NULL, 0, 0, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, 0, NULL, NULL, 0, NULL, 0, '2026-04-02 18:05:20', '2026-04-02 18:05:20', 'enabled'),
(2220, 'Lux Combo', 1, 'combo', 1, NULL, NULL, 145, NULL, 410, NULL, NULL, NULL, 'exclusive', 0, 0.0000, 'cmbp1', 'C128', NULL, NULL, 0, 0, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '<p>only testing</p>', 1, NULL, 0, NULL, NULL, 0, NULL, 0, '2026-04-02 18:16:12', '2026-04-02 18:16:12', 'enabled');

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

--
-- Table structure for table `product_locations`
--

CREATE TABLE `product_locations` (
  `product_id` int(11) NOT NULL,
  `location_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_locations`
--

INSERT INTO `product_locations` (`product_id`, `location_id`) VALUES
(2216, 19),
(2217, 1),
(2218, 1),
(2217, 19),
(2219, 19),
(2220, 19);

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

--
-- Table structure for table `product_racks`
--

CREATE TABLE `product_racks` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `location_id` int(10) UNSIGNED NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL,
  `rack` varchar(191) DEFAULT NULL,
  `row` varchar(191) DEFAULT NULL,
  `position` varchar(191) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_racks`
--

INSERT INTO `product_racks` (`id`, `business_id`, `location_id`, `product_id`, `rack`, `row`, `position`, `created_at`, `updated_at`) VALUES
(232, 1, 1, 2220, NULL, NULL, NULL, '2026-04-02 18:16:12', '2026-04-02 18:16:12'),
(233, 1, 19, 2220, NULL, NULL, NULL, '2026-04-02 18:16:12', '2026-04-02 18:16:12');

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

--
-- Table structure for table `product_variations`
--

CREATE TABLE `product_variations` (
  `id` int(10) UNSIGNED NOT NULL,
  `variation_template_id` int(11) DEFAULT NULL,
  `name` varchar(191) NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL,
  `is_dummy` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_variations`
--

INSERT INTO `product_variations` (`id`, `variation_template_id`, `name`, `product_id`, `is_dummy`, `created_at`, `updated_at`) VALUES
(2216, NULL, 'DUMMY', 2216, 1, '2026-04-02 17:53:21', '2026-04-02 17:53:21'),
(2217, NULL, 'DUMMY', 2217, 1, '2026-04-02 17:58:42', '2026-04-02 17:58:42'),
(2218, NULL, 'DUMMY', 2218, 1, '2026-04-02 18:03:14', '2026-04-02 18:03:14'),
(2219, NULL, 'DUMMY', 2219, 1, '2026-04-02 18:05:20', '2026-04-02 18:05:20'),
(2220, NULL, 'DUMMY', 2220, 1, '2026-04-02 18:16:12', '2026-04-02 18:16:12');

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

--
-- Table structure for table `promotions`
--

CREATE TABLE `promotions` (
  `id` int(10) UNSIGNED NOT NULL,
  `promotion_type` enum('product_discount','buy_x_get_y') NOT NULL DEFAULT 'product_discount',
  `business_id` int(10) UNSIGNED NOT NULL,
  `product_id` int(10) UNSIGNED DEFAULT NULL,
  `get_product_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Product to get free/discounted (for Buy X Get Y). Null means same product.',
  `get_variation_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Variation to get free/discounted (for Buy X Get Y). Null means all variations.',
  `variation_id` int(10) UNSIGNED DEFAULT NULL,
  `name` varchar(191) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `discount_percentage` decimal(5,2) NOT NULL,
  `buy_quantity` int(11) DEFAULT NULL COMMENT 'X quantity - buy this many',
  `get_quantity` int(11) DEFAULT NULL COMMENT 'Y quantity - get this many free/discounted',
  `get_discount_type` enum('free','percentage','fixed') DEFAULT NULL COMMENT 'Type of discount for Y items',
  `get_discount_value` decimal(10,2) DEFAULT NULL COMMENT 'Discount value (percentage or fixed amount)',
  `daily_quantity_limit` int(11) DEFAULT NULL COMMENT 'Daily limit for quantity (pieces) - null means unlimited',
  `daily_invoice_limit` int(11) DEFAULT NULL COMMENT 'Daily limit for invoices - null means unlimited',
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `location_id` int(10) UNSIGNED DEFAULT NULL,
  `created_by` int(10) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `promotion_audit_logs`
--

CREATE TABLE `promotion_audit_logs` (
  `id` int(10) UNSIGNED NOT NULL,
  `promotion_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `action` varchar(191) NOT NULL,
  `old_values` text DEFAULT NULL,
  `new_values` text DEFAULT NULL,
  `changes` text DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `promotion_daily_usage`
--

CREATE TABLE `promotion_daily_usage` (
  `id` int(10) UNSIGNED NOT NULL,
  `promotion_id` int(10) UNSIGNED NOT NULL,
  `usage_date` date NOT NULL,
  `quantity_used` int(11) NOT NULL DEFAULT 0 COMMENT 'Total quantity sold today',
  `invoice_count` int(11) NOT NULL DEFAULT 0 COMMENT 'Total invoices with this promotion today',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `promotion_templates`
--

CREATE TABLE `promotion_templates` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `description` text DEFAULT NULL,
  `promotion_type` varchar(191) NOT NULL,
  `template_data` text NOT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `purchase_lines`
--

CREATE TABLE `purchase_lines` (
  `id` int(10) UNSIGNED NOT NULL,
  `transaction_id` int(10) UNSIGNED NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL,
  `variation_id` int(10) UNSIGNED NOT NULL,
  `quantity` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `serial_purchase_code` varchar(191) DEFAULT NULL,
  `secondary_unit_quantity` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `pp_without_discount` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT 'Purchase price before inline discounts',
  `discount_percent` decimal(5,2) NOT NULL DEFAULT 0.00 COMMENT 'Inline discount percentage',
  `purchase_price` decimal(22,4) NOT NULL,
  `purchase_price_inc_tax` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `item_tax` decimal(22,4) NOT NULL COMMENT 'Tax for one quantity',
  `tax_id` int(10) UNSIGNED DEFAULT NULL,
  `line_discount_type` enum('fixed','percentage') DEFAULT NULL,
  `line_discount_amount` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `purchase_requisition_line_id` int(11) DEFAULT NULL,
  `purchase_order_line_id` int(11) DEFAULT NULL,
  `quantity_sold` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT 'Quanity sold from this purchase line',
  `quantity_adjusted` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT 'Quanity adjusted in stock adjustment from this purchase line',
  `quantity_returned` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `po_quantity_purchased` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `mfg_quantity_used` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `mfg_date` date DEFAULT NULL,
  `exp_date` date DEFAULT NULL,
  `lot_number` varchar(191) DEFAULT NULL,
  `sub_unit_id` int(11) DEFAULT NULL,
  `transfer_return` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_lines`
--

INSERT INTO `purchase_lines` (`id`, `transaction_id`, `product_id`, `variation_id`, `quantity`, `serial_purchase_code`, `secondary_unit_quantity`, `pp_without_discount`, `discount_percent`, `purchase_price`, `purchase_price_inc_tax`, `item_tax`, `tax_id`, `line_discount_type`, `line_discount_amount`, `purchase_requisition_line_id`, `purchase_order_line_id`, `quantity_sold`, `quantity_adjusted`, `quantity_returned`, `po_quantity_purchased`, `mfg_quantity_used`, `mfg_date`, `exp_date`, `lot_number`, `sub_unit_id`, `transfer_return`, `created_at`, `updated_at`) VALUES
(1716, 3372, 2216, 2221, 100.0000, '2216RZEAYP', 0.0000, 40.0000, 0.00, 40.0000, 40.0000, 0.0000, NULL, NULL, 0.0000, NULL, NULL, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, NULL, NULL, NULL, 1, 0, '2026-04-02 17:55:24', '2026-04-02 17:55:24'),
(1717, 3373, 2217, 2222, 10.0000, '2217pqYupZ', 0.0000, 100000.0000, 0.00, 100000.0000, 100000.0000, 0.0000, NULL, NULL, 0.0000, NULL, NULL, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, NULL, NULL, NULL, NULL, 0, '2026-04-02 17:59:49', '2026-04-02 17:59:49'),
(1718, 3374, 2218, 2223, 4.0000, '2218vP4lCA', 0.0000, 200000.0000, 0.00, 200000.0000, 200000.0000, 0.0000, NULL, NULL, 0.0000, NULL, NULL, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, NULL, NULL, NULL, NULL, 0, '2026-04-02 18:03:47', '2026-04-02 18:03:47'),
(1719, 3375, 2219, 2224, 10.0000, '22192frbOz', 0.0000, 50.0000, 0.00, 50.0000, 50.0000, 0.0000, NULL, NULL, 0.0000, NULL, NULL, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, NULL, NULL, NULL, 1, 0, '2026-04-02 18:05:28', '2026-04-02 18:05:28'),
(1720, 3376, 2216, 2221, 1000.0000, '2216p0jGgO', 0.0000, 40.0000, 0.00, 40.0000, 40.0000, 0.0000, NULL, 'fixed', 0.0000, NULL, NULL, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, NULL, NULL, NULL, NULL, 0, '2026-04-02 18:19:45', '2026-04-02 18:19:45'),
(1721, 3376, 2219, 2224, 1000.0000, '2219HR6MJQ', 0.0000, 50.0000, 0.00, 50.0000, 50.0000, 0.0000, NULL, 'fixed', 0.0000, NULL, NULL, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, NULL, NULL, NULL, NULL, 0, '2026-04-02 18:19:45', '2026-04-02 18:19:45'),
(1722, 3377, 2218, 2223, 5.0000, '2218nLrbrZ', 0.0000, 200000.0000, 0.00, 200000.0000, 200000.0000, 0.0000, NULL, 'fixed', 0.0000, NULL, NULL, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, NULL, NULL, 'Lot123', NULL, 0, '2026-04-02 18:27:50', '2026-04-02 18:27:50'),
(1723, 3378, 2218, 2223, 3.0000, '2218Uk1CYQ', 0.0000, 200000.0000, 0.00, 200000.0000, 200000.0000, 0.0000, NULL, 'fixed', 0.0000, NULL, NULL, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, NULL, NULL, NULL, NULL, 0, '2026-04-02 18:33:39', '2026-04-02 18:33:39'),
(1724, 3379, 2216, 2221, 1000.0000, '2216hjSooM', 0.0000, 40.0000, 0.00, 40.0000, 40.0000, 0.0000, NULL, 'fixed', 0.0000, NULL, NULL, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, NULL, '2026-04-03', 'LuxLot1', NULL, 0, '2026-04-02 18:37:03', '2026-04-02 18:37:03'),
(1725, 3379, 2219, 2224, 1000.0000, '2219pdqNI5', 0.0000, 50.0000, 0.00, 50.0000, 50.0000, 0.0000, NULL, 'fixed', 0.0000, NULL, NULL, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, NULL, '2026-04-03', 'LuxLot1', NULL, 0, '2026-04-02 18:37:03', '2026-04-02 18:37:03');

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

--
-- Table structure for table `reference_counts`
--

CREATE TABLE `reference_counts` (
  `id` int(10) UNSIGNED NOT NULL,
  `ref_type` varchar(191) NOT NULL,
  `ref_count` int(11) NOT NULL,
  `business_id` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `reference_counts`
--

INSERT INTO `reference_counts` (`id`, `ref_type`, `ref_count`, `business_id`, `created_at`, `updated_at`) VALUES
(181, 'business_location', 1, 1, '2026-04-02 16:17:59', '2026-04-02 16:17:59'),
(182, 'contacts', 5, 1, '2026-04-02 16:20:41', '2026-04-02 16:30:51'),
(183, 'opening_balance', 3, 1, '2026-04-02 16:23:41', '2026-04-02 16:29:25'),
(184, 'purchase_order', 1, 1, '2026-04-02 18:19:45', '2026-04-02 18:19:45'),
(185, 'purchase', 3, 1, '2026-04-02 18:27:50', '2026-04-02 18:37:03'),
(186, 'purchase_payment', 4, 1, '2026-04-02 18:31:10', '2026-04-02 18:37:03');

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

--
-- Table structure for table `repair_device_models`
--

CREATE TABLE `repair_device_models` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `repair_checklist` text DEFAULT NULL,
  `brand_id` int(10) UNSIGNED DEFAULT NULL,
  `device_id` int(10) UNSIGNED DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `repair_statuses`
--

CREATE TABLE `repair_statuses` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `color` varchar(191) DEFAULT NULL,
  `sort_order` int(11) DEFAULT NULL,
  `business_id` int(11) NOT NULL,
  `is_completed_status` tinyint(1) NOT NULL DEFAULT 0,
  `sms_template` text DEFAULT NULL,
  `email_subject` text DEFAULT NULL,
  `email_body` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `res_product_modifier_sets`
--

CREATE TABLE `res_product_modifier_sets` (
  `modifier_set_id` int(10) UNSIGNED NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL COMMENT 'Table use to store the modifier sets applicable for a product'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `res_tables`
--

CREATE TABLE `res_tables` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `location_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `description` text DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `return_groups`
--

CREATE TABLE `return_groups` (
  `id` int(11) NOT NULL,
  `business_id` int(11) NOT NULL,
  `created_at` timestamp NOT NULL,
  `updated_at` timestamp NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `rma_complain_receives`
--

CREATE TABLE `rma_complain_receives` (
  `id` int(10) UNSIGNED NOT NULL,
  `rma_number` varchar(191) NOT NULL,
  `business_id` int(11) NOT NULL,
  `location_id` int(11) DEFAULT NULL,
  `contact_id` int(11) DEFAULT NULL,
  `product_id` int(11) NOT NULL,
  `serial_id` int(11) DEFAULT NULL,
  `serial_number` varchar(191) DEFAULT NULL,
  `transaction_id` int(11) DEFAULT NULL,
  `complain_date` date NOT NULL,
  `problem_description` text DEFAULT NULL,
  `problem_id` int(11) DEFAULT NULL,
  `status` enum('pending','approved','rejected','in_process','completed','cancelled') NOT NULL DEFAULT 'pending',
  `approved_by` int(11) DEFAULT NULL,
  `approved_at` datetime DEFAULT NULL,
  `rejection_reason` text DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_by` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `rma_diagnoses`
--

CREATE TABLE `rma_diagnoses` (
  `id` int(10) UNSIGNED NOT NULL,
  `diagnosis_number` varchar(191) NOT NULL,
  `business_id` int(11) NOT NULL,
  `location_id` int(11) DEFAULT NULL,
  `complain_receive_id` int(11) NOT NULL,
  `product_id` int(11) NOT NULL,
  `serial_id` int(11) DEFAULT NULL,
  `serial_number` varchar(191) DEFAULT NULL,
  `diagnosis_date` date NOT NULL,
  `diagnosis_result` text DEFAULT NULL,
  `diagnosis_status` enum('pending','diagnosed','repairable','not_repairable') NOT NULL DEFAULT 'pending',
  `estimated_repair_cost` decimal(20,2) DEFAULT NULL,
  `technician_notes` text DEFAULT NULL,
  `technician_id` int(11) DEFAULT NULL,
  `status` enum('pending','completed','cancelled') NOT NULL DEFAULT 'pending',
  `created_by` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `rma_engineer_fixings`
--

CREATE TABLE `rma_engineer_fixings` (
  `id` int(10) UNSIGNED NOT NULL,
  `fixing_number` varchar(191) NOT NULL,
  `business_id` int(11) NOT NULL,
  `location_id` int(11) DEFAULT NULL,
  `complain_receive_id` int(11) NOT NULL,
  `diagnosis_id` int(11) DEFAULT NULL,
  `product_id` int(11) NOT NULL,
  `serial_id` int(11) DEFAULT NULL,
  `serial_number` varchar(191) DEFAULT NULL,
  `fixing_date` date NOT NULL,
  `fixing_description` text DEFAULT NULL,
  `parts_used` text DEFAULT NULL,
  `technician_notes` text DEFAULT NULL,
  `engineer_id` int(11) DEFAULT NULL,
  `fixing_status` enum('pending','in_progress','completed','failed') NOT NULL DEFAULT 'pending',
  `status` enum('pending','completed','cancelled') NOT NULL DEFAULT 'pending',
  `created_by` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `rma_item_utilizes`
--

CREATE TABLE `rma_item_utilizes` (
  `id` int(10) UNSIGNED NOT NULL,
  `utilize_number` varchar(191) NOT NULL,
  `business_id` int(11) NOT NULL,
  `location_id` int(11) DEFAULT NULL,
  `complain_receive_id` int(11) DEFAULT NULL,
  `product_id` int(11) NOT NULL,
  `serial_id` int(11) DEFAULT NULL,
  `serial_number` varchar(191) DEFAULT NULL,
  `utilize_date` date NOT NULL,
  `utilize_type` enum('scrap','refurbish','parts_harvest','donation','other') NOT NULL DEFAULT 'scrap',
  `utilize_notes` text DEFAULT NULL,
  `status` enum('pending','completed','cancelled') NOT NULL DEFAULT 'pending',
  `created_by` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `rma_problem_setups`
--

CREATE TABLE `rma_problem_setups` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_id` int(11) NOT NULL,
  `problem_code` varchar(191) DEFAULT NULL,
  `problem_name` varchar(191) NOT NULL,
  `description` text DEFAULT NULL,
  `problem_category` enum('hardware','software','electrical','mechanical','cosmetic','other') NOT NULL DEFAULT 'other',
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` int(11) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `rma_replacement_deliveries`
--

CREATE TABLE `rma_replacement_deliveries` (
  `id` int(10) UNSIGNED NOT NULL,
  `delivery_number` varchar(191) NOT NULL,
  `business_id` int(11) NOT NULL,
  `location_id` int(11) DEFAULT NULL,
  `contact_id` int(11) DEFAULT NULL,
  `replace_in_id` int(11) NOT NULL,
  `product_id` int(11) NOT NULL,
  `serial_id` int(11) DEFAULT NULL,
  `serial_number` varchar(191) DEFAULT NULL,
  `delivery_date` date NOT NULL,
  `transaction_id` int(11) DEFAULT NULL,
  `delivery_notes` text DEFAULT NULL,
  `status` enum('pending','delivered','cancelled') NOT NULL DEFAULT 'pending',
  `delivered_by` int(11) DEFAULT NULL,
  `created_by` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `rma_replace_ins`
--

CREATE TABLE `rma_replace_ins` (
  `id` int(10) UNSIGNED NOT NULL,
  `replace_in_number` varchar(191) NOT NULL,
  `business_id` int(11) NOT NULL,
  `location_id` int(11) DEFAULT NULL,
  `replace_out_id` int(11) NOT NULL,
  `product_id` int(11) NOT NULL,
  `serial_id` int(11) DEFAULT NULL,
  `serial_number` varchar(191) DEFAULT NULL,
  `replace_in_date` date NOT NULL,
  `condition_notes` text DEFAULT NULL,
  `condition` enum('good','damaged','defective') NOT NULL DEFAULT 'good',
  `notes` text DEFAULT NULL,
  `status` enum('pending','completed','cancelled') NOT NULL DEFAULT 'pending',
  `created_by` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `rma_replace_outs`
--

CREATE TABLE `rma_replace_outs` (
  `id` int(10) UNSIGNED NOT NULL,
  `replace_out_number` varchar(191) NOT NULL,
  `business_id` int(11) NOT NULL,
  `location_id` int(11) DEFAULT NULL,
  `complain_receive_id` int(11) NOT NULL,
  `product_id` int(11) NOT NULL,
  `serial_id` int(11) DEFAULT NULL,
  `serial_number` varchar(191) DEFAULT NULL,
  `replacement_product_id` int(11) DEFAULT NULL,
  `replacement_serial_id` int(11) DEFAULT NULL,
  `replacement_serial_number` varchar(191) DEFAULT NULL,
  `replace_out_date` date NOT NULL,
  `notes` text DEFAULT NULL,
  `status` enum('pending','completed','cancelled') NOT NULL DEFAULT 'pending',
  `created_by` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `rma_serial_histories`
--

CREATE TABLE `rma_serial_histories` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_id` int(11) NOT NULL,
  `serial_id` int(11) NOT NULL,
  `serial_number` varchar(191) NOT NULL,
  `product_id` int(11) NOT NULL,
  `action_type` varchar(191) NOT NULL,
  `reference_id` int(11) DEFAULT NULL,
  `reference_number` varchar(191) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `rma_service_bills`
--

CREATE TABLE `rma_service_bills` (
  `id` int(10) UNSIGNED NOT NULL,
  `service_bill_number` varchar(191) NOT NULL,
  `business_id` int(11) NOT NULL,
  `location_id` int(11) DEFAULT NULL,
  `contact_id` int(11) DEFAULT NULL,
  `complain_receive_id` int(11) DEFAULT NULL,
  `diagnosis_id` int(11) DEFAULT NULL,
  `product_id` int(11) NOT NULL,
  `serial_id` int(11) DEFAULT NULL,
  `serial_number` varchar(191) DEFAULT NULL,
  `service_date` date NOT NULL,
  `service_charge` decimal(20,2) NOT NULL DEFAULT 0.00,
  `parts_cost` decimal(20,2) NOT NULL DEFAULT 0.00,
  `labor_cost` decimal(20,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(20,2) NOT NULL DEFAULT 0.00,
  `transaction_id` int(11) DEFAULT NULL,
  `service_notes` text DEFAULT NULL,
  `payment_status` enum('pending','partial','paid') NOT NULL DEFAULT 'pending',
  `status` enum('pending','completed','cancelled') NOT NULL DEFAULT 'pending',
  `created_by` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `guard_name` varchar(191) NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `is_default` tinyint(1) NOT NULL DEFAULT 0,
  `is_service_staff` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` (`id`, `name`, `guard_name`, `business_id`, `is_default`, `is_service_staff`, `created_at`, `updated_at`) VALUES
(1, 'Admin#1', 'web', 1, 1, 0, '2024-10-25 16:39:24', '2024-10-25 16:39:24'),
(2, 'Cashier#1', 'web', 1, 0, 0, '2024-10-25 16:39:24', '2024-10-25 16:39:24'),
(33, 'Branch Manager#1', 'web', 1, 0, 0, '2026-04-02 16:15:06', '2026-04-02 16:15:06');

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

--
-- Table structure for table `role_has_permissions`
--

CREATE TABLE `role_has_permissions` (
  `permission_id` int(10) UNSIGNED NOT NULL,
  `role_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `role_has_permissions`
--

INSERT INTO `role_has_permissions` (`permission_id`, `role_id`) VALUES
(2, 2),
(3, 2),
(6, 2),
(7, 2),
(8, 2),
(9, 2),
(10, 2),
(16, 2),
(17, 2),
(18, 2),
(19, 2),
(20, 2),
(22, 2),
(25, 2),
(26, 2),
(27, 2),
(28, 2),
(33, 2),
(34, 2),
(35, 2),
(37, 2),
(38, 2),
(39, 2),
(40, 2),
(41, 2),
(42, 2),
(45, 2),
(46, 2),
(48, 2),
(49, 2),
(50, 2),
(51, 2),
(81, 2),
(113, 2),
(114, 2),
(115, 2),
(116, 2),
(117, 2),
(118, 2),
(119, 2),
(120, 2),
(121, 2),
(122, 2),
(123, 2),
(124, 2),
(125, 2),
(132, 2),
(133, 2),
(134, 2),
(135, 2),
(139, 2),
(149, 2),
(157, 2),
(158, 2),
(159, 2),
(160, 2),
(161, 2),
(162, 2),
(163, 2),
(164, 2),
(165, 2),
(166, 2);

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

--
-- Table structure for table `selling_price_groups`
--

CREATE TABLE `selling_price_groups` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `description` text DEFAULT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `sell_exchange`
--

CREATE TABLE `sell_exchange` (
  `id` int(11) NOT NULL,
  `business_id` varchar(255) DEFAULT NULL,
  `location_id` varchar(255) DEFAULT NULL,
  `transaction_id` varchar(255) DEFAULT NULL,
  `status` varchar(255) DEFAULT NULL,
  `reason` text DEFAULT NULL,
  `amount_before_exchange` varchar(255) DEFAULT NULL,
  `amount_after_exchange` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `sell_exchange_product`
--

CREATE TABLE `sell_exchange_product` (
  `id` int(11) NOT NULL,
  `sell_exchange_id` varchar(255) DEFAULT NULL,
  `exchange_product_id` varchar(255) DEFAULT NULL,
  `new_product_id` varchar(255) DEFAULT NULL,
  `exchange_product_variation_id` varchar(255) DEFAULT NULL,
  `new_product_variation_id` varchar(255) DEFAULT NULL,
  `exchange_product_quantity` varchar(255) DEFAULT NULL,
  `new_product_quantity` varchar(255) DEFAULT NULL,
  `exchange_product_unit_price` varchar(255) DEFAULT NULL,
  `new_product_unit_price` varchar(255) DEFAULT NULL,
  `exchange_product_total_price` varchar(255) DEFAULT NULL,
  `new_product_total_price` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `sell_line_warranties`
--

CREATE TABLE `sell_line_warranties` (
  `sell_line_id` int(11) NOT NULL,
  `warranty_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `serial_numbers`
--

CREATE TABLE `serial_numbers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `business_id` int(11) DEFAULT NULL,
  `location_id` int(10) UNSIGNED NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL,
  `variation_id` int(10) UNSIGNED NOT NULL,
  `serial_number` varchar(191) NOT NULL,
  `purchase_status` varchar(191) NOT NULL DEFAULT 'received',
  `stock_status` varchar(191) NOT NULL DEFAULT 'available',
  `transaction_id` bigint(20) DEFAULT NULL,
  `serial_purchase_code` varchar(191) DEFAULT NULL,
  `is_return` int(11) DEFAULT NULL,
  `is_p_return` int(11) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `serial_numbers`
--

INSERT INTO `serial_numbers` (`id`, `business_id`, `location_id`, `product_id`, `variation_id`, `serial_number`, `purchase_status`, `stock_status`, `transaction_id`, `serial_purchase_code`, `is_return`, `is_p_return`, `created_at`, `updated_at`) VALUES
(607, 1, 1, 2217, 2222, 's1', 'received', 'available', NULL, '2217pqYupZ', NULL, NULL, NULL, NULL),
(608, 1, 1, 2217, 2222, 's2', 'received', 'available', NULL, '2217pqYupZ', NULL, NULL, NULL, NULL),
(609, 1, 1, 2217, 2222, 's3', 'received', 'available', NULL, '2217pqYupZ', NULL, NULL, NULL, NULL),
(610, 1, 1, 2217, 2222, 's4', 'received', 'available', NULL, '2217pqYupZ', NULL, NULL, NULL, NULL),
(611, 1, 1, 2217, 2222, 's5', 'received', 'available', NULL, '2217pqYupZ', NULL, NULL, NULL, NULL),
(612, 1, 1, 2217, 2222, 's6', 'received', 'available', NULL, '2217pqYupZ', NULL, NULL, NULL, NULL),
(613, 1, 1, 2217, 2222, 's7', 'received', 'available', NULL, '2217pqYupZ', NULL, NULL, NULL, NULL),
(614, 1, 1, 2217, 2222, 's8', 'received', 'available', NULL, '2217pqYupZ', NULL, NULL, NULL, NULL),
(615, 1, 1, 2217, 2222, 's9', 'received', 'available', NULL, '2217pqYupZ', NULL, NULL, NULL, NULL),
(616, 1, 1, 2217, 2222, 's10', 'received', 'available', NULL, '2217pqYupZ', NULL, NULL, NULL, NULL),
(617, 1, 1, 2218, 2223, 'iphone1', 'received', 'available', NULL, '2218vP4lCA', NULL, NULL, NULL, NULL),
(618, 1, 1, 2218, 2223, 'iphone2', 'received', 'available', NULL, '2218vP4lCA', NULL, NULL, NULL, NULL),
(619, 1, 1, 2218, 2223, 'iphone3', 'received', 'available', NULL, '2218vP4lCA', NULL, NULL, NULL, NULL),
(620, 1, 1, 2218, 2223, 'iphone4', 'received', 'available', NULL, '2218vP4lCA', NULL, NULL, NULL, NULL),
(621, 1, 1, 2218, 2223, 'fon1', 'received', 'available', NULL, '2218nLrbrZ', NULL, NULL, NULL, NULL),
(622, 1, 1, 2218, 2223, 'fon2', 'received', 'available', NULL, '2218nLrbrZ', NULL, NULL, NULL, NULL),
(623, 1, 1, 2218, 2223, 'fon3', 'received', 'available', NULL, '2218nLrbrZ', NULL, NULL, NULL, NULL),
(624, 1, 1, 2218, 2223, 'fon4', 'received', 'available', NULL, '2218nLrbrZ', NULL, NULL, NULL, NULL),
(625, 1, 1, 2218, 2223, 'fon5', 'received', 'available', NULL, '2218nLrbrZ', NULL, NULL, NULL, NULL),
(626, 1, 1, 2218, 2223, 'ff1', 'received', 'available', NULL, '2218Uk1CYQ', NULL, NULL, NULL, NULL),
(627, 1, 1, 2218, 2223, 'ff2', 'received', 'available', NULL, '2218Uk1CYQ', NULL, NULL, NULL, NULL),
(628, 1, 1, 2218, 2223, 'ff3', 'received', 'available', NULL, '2218Uk1CYQ', NULL, NULL, NULL, NULL);

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

--
-- Table structure for table `service_warranties`
--

CREATE TABLE `service_warranties` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `location_id` int(10) UNSIGNED NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL,
  `serial_id` int(10) UNSIGNED DEFAULT NULL,
  `service_transaction_id` int(10) UNSIGNED DEFAULT NULL,
  `service_fee` decimal(22,4) DEFAULT NULL,
  `status` varchar(191) NOT NULL DEFAULT 'received',
  `received_time` timestamp NULL DEFAULT NULL,
  `delivery_time` timestamp NULL DEFAULT NULL,
  `old_serial` varchar(191) DEFAULT NULL,
  `new_serial` varchar(191) DEFAULT NULL,
  `service_recived_no` varchar(191) DEFAULT NULL,
  `service_delivery_no` varchar(191) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `sessions`
--

CREATE TABLE `sessions` (
  `id` varchar(191) NOT NULL,
  `user_id` int(10) UNSIGNED DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `payload` text NOT NULL,
  `last_activity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `sheet_spreadsheets`
--

CREATE TABLE `sheet_spreadsheets` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `sheet_data` longtext NOT NULL,
  `created_by` int(11) NOT NULL,
  `folder_id` int(11) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `sheet_spreadsheet_shares`
--

CREATE TABLE `sheet_spreadsheet_shares` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sheet_spreadsheet_id` bigint(20) UNSIGNED NOT NULL,
  `shared_with` varchar(191) NOT NULL COMMENT 'Shared with like user/role/todo',
  `shared_id` int(11) NOT NULL COMMENT 'Id of shared with like user_id/role_id/todo_id',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `staff_awards`
--

CREATE TABLE `staff_awards` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `staff_id` int(10) UNSIGNED NOT NULL,
  `period_id` bigint(20) UNSIGNED DEFAULT NULL,
  `period_type` enum('weekly','monthly','yearly') NOT NULL,
  `period_start` date NOT NULL,
  `period_end` date NOT NULL,
  `rank_position` int(11) NOT NULL,
  `sales_total` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `transaction_count` int(11) NOT NULL DEFAULT 0,
  `avg_transaction_value` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `performance_points` int(11) NOT NULL DEFAULT 0,
  `final_score` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `award_type` enum('manual','catalog') DEFAULT NULL,
  `catalog_item_id` int(10) UNSIGNED DEFAULT NULL,
  `award_quantity` int(11) NOT NULL DEFAULT 1,
  `gift_description` varchar(191) DEFAULT NULL,
  `gift_monetary_value` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `stock_deducted` tinyint(1) NOT NULL DEFAULT 0,
  `award_notes` text DEFAULT NULL,
  `is_awarded` tinyint(1) NOT NULL DEFAULT 0,
  `awarded_by` int(10) UNSIGNED DEFAULT NULL,
  `awarded_date` timestamp NULL DEFAULT NULL,
  `notification_sent` tinyint(1) NOT NULL DEFAULT 0,
  `certificate_path` varchar(191) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `staff_award_periods`
--

CREATE TABLE `staff_award_periods` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `period_type` enum('weekly','monthly','yearly') NOT NULL,
  `period_start` date NOT NULL,
  `period_end` date NOT NULL,
  `winner_count` int(11) NOT NULL DEFAULT 10,
  `is_finalized` tinyint(1) NOT NULL DEFAULT 0,
  `finalized_at` timestamp NULL DEFAULT NULL,
  `finalized_by` int(10) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `staff_performance_activities`
--

CREATE TABLE `staff_performance_activities` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `staff_id` int(10) UNSIGNED NOT NULL,
  `activity_type` enum('punctuality','customer_service','upselling','teamwork','training_completion','cleanliness','other') NOT NULL,
  `points` int(11) NOT NULL,
  `description` text DEFAULT NULL,
  `reference_url` varchar(191) DEFAULT NULL,
  `verification_notes` text DEFAULT NULL,
  `recorded_by` int(10) UNSIGNED NOT NULL,
  `recorded_date` date NOT NULL,
  `status` enum('pending','verified','rejected') NOT NULL DEFAULT 'verified',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `staff_recognition_settings`
--

CREATE TABLE `staff_recognition_settings` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `performance_weights` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `activity_points` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `min_transactions_weekly` int(11) NOT NULL DEFAULT 10,
  `min_transactions_monthly` int(11) NOT NULL DEFAULT 50,
  `min_transactions_yearly` int(11) NOT NULL DEFAULT 500,
  `auto_finalize_periods` tinyint(1) NOT NULL DEFAULT 0,
  `send_notifications` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Table structure for table `stock_adjustments_temp`
--

CREATE TABLE `stock_adjustments_temp` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `stock_adjustment_lines`
--

CREATE TABLE `stock_adjustment_lines` (
  `id` int(10) UNSIGNED NOT NULL,
  `transaction_id` int(10) UNSIGNED NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL,
  `variation_id` int(10) UNSIGNED NOT NULL,
  `quantity` decimal(22,4) NOT NULL,
  `adjustment_unit_id` int(11) DEFAULT NULL,
  `secondary_unit_quantity` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `unit_price` decimal(22,4) DEFAULT NULL COMMENT 'Last purchase unit price',
  `removed_purchase_line` int(11) DEFAULT NULL,
  `lot_no_line_id` int(11) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `subscriptions`
--

CREATE TABLE `subscriptions` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `package_id` int(10) UNSIGNED NOT NULL,
  `start_date` date DEFAULT NULL,
  `trial_end_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `package_price` decimal(22,4) NOT NULL,
  `original_price` decimal(22,4) DEFAULT NULL,
  `coupon_code` varchar(191) DEFAULT NULL,
  `package_details` longtext NOT NULL,
  `created_id` int(10) UNSIGNED NOT NULL,
  `paid_via` varchar(191) DEFAULT NULL,
  `payment_transaction_id` varchar(191) DEFAULT NULL,
  `status` enum('approved','waiting','declined') NOT NULL DEFAULT 'waiting',
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `superadmin_communicator_logs`
--

CREATE TABLE `superadmin_communicator_logs` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_ids` text DEFAULT NULL,
  `subject` varchar(191) DEFAULT NULL,
  `message` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `superadmin_coupons`
--

CREATE TABLE `superadmin_coupons` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `coupon_code` varchar(191) NOT NULL,
  `discount_type` varchar(191) NOT NULL,
  `discount` decimal(8,2) NOT NULL,
  `expiry_date` date DEFAULT NULL,
  `applied_on_packages` varchar(191) DEFAULT NULL,
  `applied_on_business` varchar(191) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `superadmin_frontend_pages`
--

CREATE TABLE `superadmin_frontend_pages` (
  `id` int(10) UNSIGNED NOT NULL,
  `title` varchar(191) DEFAULT NULL,
  `slug` varchar(191) NOT NULL,
  `content` longtext NOT NULL,
  `is_shown` tinyint(1) NOT NULL,
  `menu_order` int(11) DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `tax_rates`
--

CREATE TABLE `tax_rates` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `amount` double(22,4) NOT NULL,
  `is_tax_group` tinyint(1) NOT NULL DEFAULT 0,
  `for_tax_group` tinyint(1) NOT NULL DEFAULT 0,
  `created_by` int(10) UNSIGNED NOT NULL,
  `woocommerce_tax_rate_id` int(11) DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `tazas`
--

CREATE TABLE `tazas` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `currency_id` int(10) UNSIGNED NOT NULL,
  `value` decimal(50,15) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `alias` varchar(191) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `transaction_exchanges`
--

CREATE TABLE `transaction_exchanges` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `location_id` int(10) UNSIGNED NOT NULL,
  `original_transaction_id` int(10) UNSIGNED NOT NULL COMMENT 'Reference to original sale',
  `exchange_transaction_id` int(10) UNSIGNED NOT NULL COMMENT 'New exchange transaction',
  `exchange_ref_no` varchar(191) NOT NULL,
  `exchange_date` datetime NOT NULL,
  `total_exchange_amount` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT 'Net amount (positive=customer pays, negative=refund)',
  `status` enum('pending','completed','cancelled') NOT NULL DEFAULT 'pending',
  `created_by` int(10) UNSIGNED NOT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `original_amount` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT 'Total amount of returned items',
  `new_amount` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT 'Total amount of new items',
  `exchange_difference` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT 'Difference amount (new - original)',
  `payment_received` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT 'Additional payment received from customer',
  `refund_given` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT 'Refund given to customer',
  `cancelled_at` timestamp NULL DEFAULT NULL,
  `cancelled_by` int(10) UNSIGNED DEFAULT NULL,
  `stock_adjustments` text DEFAULT NULL COMMENT 'JSON data of stock adjustments for reversal'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `transaction_exchange_lines`
--

CREATE TABLE `transaction_exchange_lines` (
  `id` int(10) UNSIGNED NOT NULL,
  `exchange_id` int(10) UNSIGNED NOT NULL,
  `original_sell_line_id` int(10) UNSIGNED NOT NULL COMMENT 'Original item being returned',
  `new_sell_line_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'New item being sold (if any)',
  `exchange_type` enum('return_only','exchange_with_new','new_only') NOT NULL DEFAULT 'exchange_with_new',
  `original_quantity` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `original_unit_price` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `new_quantity` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `new_unit_price` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `price_difference` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT 'New price - Original price',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `transaction_sell_lines`
--

CREATE TABLE `transaction_sell_lines` (
  `id` int(10) UNSIGNED NOT NULL,
  `transaction_id` int(10) UNSIGNED NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL,
  `variation_id` int(10) UNSIGNED NOT NULL,
  `quantity` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `mfg_waste_percent` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `mfg_ingredient_group_id` int(11) DEFAULT NULL,
  `sell_unit_id` int(11) DEFAULT NULL,
  `secondary_unit_quantity` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `quantity_returned` decimal(20,4) NOT NULL DEFAULT 0.0000,
  `unit_price_before_discount` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `unit_price` decimal(22,4) DEFAULT NULL COMMENT 'Sell price excluding tax',
  `line_discount_type` enum('fixed','percentage') DEFAULT NULL,
  `line_discount_amount` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `unit_price_inc_tax` decimal(22,4) DEFAULT NULL COMMENT 'Sell price including tax',
  `item_tax` decimal(22,4) NOT NULL COMMENT 'Tax for one quantity',
  `tax_id` int(10) UNSIGNED DEFAULT NULL,
  `discount_id` int(11) DEFAULT NULL,
  `lot_no_line_id` int(11) DEFAULT NULL,
  `sell_line_note` text DEFAULT NULL,
  `woocommerce_line_items_id` int(11) DEFAULT NULL,
  `so_line_id` int(11) DEFAULT NULL,
  `so_quantity_invoiced` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `res_service_staff_id` int(11) DEFAULT NULL,
  `res_line_order_status` varchar(191) DEFAULT NULL,
  `parent_sell_line_id` int(11) DEFAULT NULL,
  `children_type` varchar(191) NOT NULL DEFAULT '' COMMENT 'Type of children for the parent, like modifier or combo',
  `sub_unit_id` int(11) DEFAULT NULL,
  `transfer_return` int(11) DEFAULT NULL,
  `return_sell_line_id` int(11) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `is_exchange_return` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Mark if this line item was returned in exchange',
  `exchange_parent_line_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'Reference to original sell line if this is exchange replacement'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `transaction_sell_lines_purchase_lines`
--

CREATE TABLE `transaction_sell_lines_purchase_lines` (
  `id` int(10) UNSIGNED NOT NULL,
  `sell_line_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'id from transaction_sell_lines',
  `stock_adjustment_line_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'id from stock_adjustment_lines',
  `purchase_line_id` int(10) UNSIGNED NOT NULL COMMENT 'id from purchase_lines',
  `quantity` decimal(22,4) NOT NULL,
  `qty_returned` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `types_of_services`
--

CREATE TABLE `types_of_services` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `description` text DEFAULT NULL,
  `business_id` int(11) NOT NULL,
  `location_price_group` text DEFAULT NULL,
  `packing_charge` decimal(22,4) DEFAULT NULL,
  `packing_charge_type` enum('fixed','percent') DEFAULT NULL,
  `enable_custom_fields` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `units`
--

CREATE TABLE `units` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `actual_name` varchar(191) NOT NULL,
  `short_name` varchar(191) NOT NULL,
  `allow_decimal` tinyint(1) NOT NULL,
  `base_unit_id` int(11) DEFAULT NULL,
  `base_unit_multiplier` decimal(20,4) DEFAULT NULL,
  `created_by` int(10) UNSIGNED NOT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `units`
--

INSERT INTO `units` (`id`, `business_id`, `actual_name`, `short_name`, `allow_decimal`, `base_unit_id`, `base_unit_multiplier`, `created_by`, `deleted_at`, `created_at`, `updated_at`) VALUES
(1, 1, 'Pieces', 'Pc(s)', 0, NULL, NULL, 1, NULL, '2024-10-25 16:39:24', '2024-10-25 16:39:24'),
(90, 1, 'Dozen', 'DZN', 0, 1, 12.0000, 1, NULL, '2026-04-02 17:34:11', '2026-04-02 17:35:03'),
(91, 1, 'Liter', 'LTR', 0, NULL, NULL, 1, NULL, '2026-04-02 17:34:53', '2026-04-02 17:34:53'),
(92, 1, 'Half Dozen', 'HFDZN', 0, 1, 6.0000, 1, NULL, '2026-04-02 17:35:34', '2026-04-02 17:35:34');

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

--
-- Table structure for table `user_contact_access`
--

CREATE TABLE `user_contact_access` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(11) NOT NULL,
  `contact_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_contact_access`
--

INSERT INTO `user_contact_access` (`id`, `user_id`, `contact_id`) VALUES
(1, 34, 429);

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

--
-- Table structure for table `variations`
--

CREATE TABLE `variations` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL,
  `sub_sku` varchar(191) DEFAULT NULL,
  `product_variation_id` int(10) UNSIGNED NOT NULL,
  `woocommerce_variation_id` int(11) DEFAULT NULL,
  `variation_value_id` int(11) DEFAULT NULL,
  `default_purchase_price` decimal(22,4) DEFAULT NULL,
  `dpp_inc_tax` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `profit_percent` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `default_sell_price` decimal(22,4) DEFAULT NULL,
  `sell_price_inc_tax` decimal(22,4) DEFAULT NULL COMMENT 'Sell price including tax',
  `first_unit_sku` varchar(191) DEFAULT NULL COMMENT 'First Unit SKU',
  `fu_default_purchase_price` decimal(22,4) DEFAULT NULL COMMENT 'First Unit',
  `fu_dpp_inc_tax` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT 'First Unit',
  `fu_profit_percent` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT 'First Unit',
  `fu_default_sell_price` decimal(22,4) DEFAULT NULL COMMENT 'First Unit',
  `fu_sell_price_inc_tax` decimal(22,4) DEFAULT NULL COMMENT 'First Unit',
  `second_unit_sku` varchar(191) DEFAULT NULL COMMENT 'Second Unit SKU',
  `su_default_purchase_price` decimal(22,4) DEFAULT NULL COMMENT 'Second Unit',
  `su_dpp_inc_tax` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT 'Second Unit',
  `su_profit_percent` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT 'Second Unit',
  `su_default_sell_price` decimal(22,4) DEFAULT NULL COMMENT 'Second Unit',
  `su_sell_price_inc_tax` decimal(22,4) DEFAULT NULL COMMENT 'Second Unit',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `combo_variations` text DEFAULT NULL COMMENT 'Contains the combo variation details',
  `modifier_qty` decimal(10,2) DEFAULT NULL,
  `modifier_product` bigint(20) DEFAULT NULL,
  `color_button_modifier` varchar(191) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `variations`
--

INSERT INTO `variations` (`id`, `name`, `product_id`, `sub_sku`, `product_variation_id`, `woocommerce_variation_id`, `variation_value_id`, `default_purchase_price`, `dpp_inc_tax`, `profit_percent`, `default_sell_price`, `sell_price_inc_tax`, `first_unit_sku`, `fu_default_purchase_price`, `fu_dpp_inc_tax`, `fu_profit_percent`, `fu_default_sell_price`, `fu_sell_price_inc_tax`, `second_unit_sku`, `su_default_purchase_price`, `su_dpp_inc_tax`, `su_profit_percent`, `su_default_sell_price`, `su_sell_price_inc_tax`, `created_at`, `updated_at`, `deleted_at`, `combo_variations`, `modifier_qty`, `modifier_product`, `color_button_modifier`) VALUES
(2221, 'DUMMY', 2216, '123', 2216, NULL, NULL, 40.0000, 40.0000, 0.0000, 40.0000, 40.0000, NULL, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, NULL, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, '2026-04-02 17:53:21', '2026-04-02 17:55:03', NULL, '[]', NULL, NULL, NULL),
(2222, 'DUMMY', 2217, 's1', 2217, NULL, NULL, 100000.0000, 100000.0000, 25.0000, 125000.0000, 125000.0000, NULL, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, NULL, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, '2026-04-02 17:58:42', '2026-04-02 18:00:55', NULL, '[]', NULL, NULL, NULL),
(2223, 'DUMMY', 2218, 'iphone17', 2218, NULL, NULL, 200000.0000, 200000.0000, 25.0000, 250000.0000, 250000.0000, NULL, NULL, 0.0000, 0.0000, NULL, NULL, NULL, NULL, 0.0000, 0.0000, NULL, NULL, '2026-04-02 18:03:14', '2026-04-02 18:27:50', NULL, '[]', NULL, NULL, NULL),
(2224, 'DUMMY', 2219, 'LX12', 2219, NULL, NULL, 50.0000, 50.0000, 50.0000, 75.0000, 75.0000, NULL, NULL, 0.0000, 0.0000, NULL, NULL, NULL, NULL, 0.0000, 0.0000, NULL, NULL, '2026-04-02 18:05:20', '2026-04-02 18:05:20', NULL, '[]', NULL, NULL, NULL),
(2225, 'DUMMY', 2220, 'cmbp1', 2220, NULL, NULL, 90.0000, 90.0000, 16.6700, 105.0000, 105.0000, NULL, NULL, 0.0000, 0.0000, NULL, NULL, NULL, NULL, 0.0000, 0.0000, NULL, NULL, '2026-04-02 18:16:12', '2026-04-02 18:16:12', NULL, '[{\"variation_id\":\"2221\",\"quantity\":1,\"unit_id\":\"1\"},{\"variation_id\":\"2224\",\"quantity\":1,\"unit_id\":\"1\"}]', NULL, NULL, NULL);

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

--
-- Table structure for table `variation_group_prices`
--

CREATE TABLE `variation_group_prices` (
  `id` int(10) UNSIGNED NOT NULL,
  `variation_id` int(10) UNSIGNED NOT NULL,
  `price_group_id` int(10) UNSIGNED NOT NULL,
  `price_inc_tax` decimal(22,4) NOT NULL,
  `price_type` varchar(191) NOT NULL DEFAULT 'fixed',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `variation_location_details`
--

CREATE TABLE `variation_location_details` (
  `id` int(10) UNSIGNED NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL,
  `product_variation_id` int(10) UNSIGNED NOT NULL COMMENT 'id from product_variations table',
  `variation_id` int(10) UNSIGNED NOT NULL,
  `location_id` int(10) UNSIGNED NOT NULL,
  `qty_available` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `variation_location_details`
--

INSERT INTO `variation_location_details` (`id`, `product_id`, `product_variation_id`, `variation_id`, `location_id`, `qty_available`, `created_at`, `updated_at`) VALUES
(1543, 2216, 2216, 2221, 19, 1100.0000, '2026-04-02 17:55:24', '2026-04-02 18:37:03'),
(1544, 2217, 2217, 2222, 1, 10.0000, '2026-04-02 17:59:49', '2026-04-02 17:59:49'),
(1545, 2218, 2218, 2223, 1, 12.0000, '2026-04-02 18:03:47', '2026-04-02 18:33:39'),
(1546, 2219, 2219, 2224, 19, 1010.0000, '2026-04-02 18:05:28', '2026-04-02 18:37:03');

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

--
-- Table structure for table `variation_templates`
--

CREATE TABLE `variation_templates` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `business_id` int(10) UNSIGNED NOT NULL,
  `woocommerce_attr_id` int(11) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `variation_templates`
--

INSERT INTO `variation_templates` (`id`, `name`, `business_id`, `woocommerce_attr_id`, `created_at`, `updated_at`) VALUES
(6, 'Color', 1, NULL, '2026-04-02 17:33:34', '2026-04-02 17:50:02'),
(7, 'Storage', 1, NULL, '2026-04-02 17:50:38', '2026-04-02 17:50:38'),
(8, 'Flavour', 1, NULL, '2026-04-02 17:52:09', '2026-04-02 17:52:09');

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

--
-- Table structure for table `variation_value_templates`
--

CREATE TABLE `variation_value_templates` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `variation_template_id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `variation_value_templates`
--

INSERT INTO `variation_value_templates` (`id`, `name`, `variation_template_id`, `created_at`, `updated_at`) VALUES
(21, 'Blue', 6, '2026-04-02 17:33:34', '2026-04-02 17:50:02'),
(22, 'Black', 6, '2026-04-02 17:50:02', '2026-04-02 17:50:02'),
(23, 'Red', 6, '2026-04-02 17:50:02', '2026-04-02 17:50:02'),
(24, 'White', 6, '2026-04-02 17:50:02', '2026-04-02 17:50:02'),
(25, '32Gb', 7, '2026-04-02 17:50:38', '2026-04-02 17:50:38'),
(26, '64Gb', 7, '2026-04-02 17:50:38', '2026-04-02 17:50:38'),
(27, '128Gb', 7, '2026-04-02 17:50:38', '2026-04-02 17:50:38'),
(28, '256Gb', 7, '2026-04-02 17:50:38', '2026-04-02 17:50:38'),
(29, '512Gb', 7, '2026-04-02 17:50:38', '2026-04-02 17:50:38'),
(30, 'Strawberry', 8, '2026-04-02 17:52:09', '2026-04-02 17:52:09'),
(31, 'Vanila', 8, '2026-04-02 17:52:09', '2026-04-02 17:52:09'),
(32, 'Chocolate', 8, '2026-04-02 17:52:09', '2026-04-02 17:52:09');

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

--
-- Table structure for table `vld_backup_1_2026_03_15_18_50_01`
--

CREATE TABLE `vld_backup_1_2026_03_15_18_50_01` (
  `id` int(10) UNSIGNED NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL,
  `product_variation_id` int(10) UNSIGNED NOT NULL COMMENT 'id from product_variations table',
  `variation_id` int(10) UNSIGNED NOT NULL,
  `location_id` int(10) UNSIGNED NOT NULL,
  `qty_available` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `vld_backup_1_2026_03_15_18_57_56`
--

CREATE TABLE `vld_backup_1_2026_03_15_18_57_56` (
  `id` int(10) UNSIGNED NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL,
  `product_variation_id` int(10) UNSIGNED NOT NULL COMMENT 'id from product_variations table',
  `variation_id` int(10) UNSIGNED NOT NULL,
  `location_id` int(10) UNSIGNED NOT NULL,
  `qty_available` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `vld_backup_1_2026_03_15_19_30_41`
--

CREATE TABLE `vld_backup_1_2026_03_15_19_30_41` (
  `id` int(10) UNSIGNED NOT NULL,
  `product_id` int(10) UNSIGNED NOT NULL,
  `product_variation_id` int(10) UNSIGNED NOT NULL COMMENT 'id from product_variations table',
  `variation_id` int(10) UNSIGNED NOT NULL,
  `location_id` int(10) UNSIGNED NOT NULL,
  `qty_available` decimal(22,4) NOT NULL DEFAULT 0.0000,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `warehouses`
--

CREATE TABLE `warehouses` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `business_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `location` varchar(255) DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT 1,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `warranties`
--

CREATE TABLE `warranties` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `business_id` int(11) NOT NULL,
  `description` text DEFAULT NULL,
  `duration` int(11) NOT NULL,
  `duration_type` enum('days','months','years') NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `warranties`
--

INSERT INTO `warranties` (`id`, `name`, `business_id`, `description`, `duration`, `duration_type`, `created_at`, `updated_at`) VALUES
(23, '7days', 1, '7day warranty', 7, 'days', '2026-04-02 15:45:34', '2026-04-02 15:45:34'),
(24, '1Month warranty', 1, NULL, 30, 'days', '2026-04-02 15:46:47', '2026-04-02 15:46:47'),
(25, '6 Month edit', 1, NULL, 6, 'months', '2026-04-02 15:48:31', '2026-04-02 15:48:51');

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

--
-- Table structure for table `woocommerce_sync_logs`
--

CREATE TABLE `woocommerce_sync_logs` (
  `id` int(10) UNSIGNED NOT NULL,
  `business_id` int(11) NOT NULL,
  `sync_type` varchar(191) NOT NULL,
  `operation_type` varchar(191) DEFAULT NULL,
  `data` longtext DEFAULT NULL,
  `details` longtext DEFAULT NULL,
  `created_by` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `accounting_accounts`
--
ALTER TABLE `accounting_accounts`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `accounting_accounts_transactions`
--
ALTER TABLE `accounting_accounts_transactions`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `accounting_account_types`
--
ALTER TABLE `accounting_account_types`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `accounting_acc_trans_mappings`
--
ALTER TABLE `accounting_acc_trans_mappings`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `accounting_budgets`
--
ALTER TABLE `accounting_budgets`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `accounts`
--
ALTER TABLE `accounts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `accounts_business_id_index` (`business_id`),
  ADD KEY `accounts_account_type_id_index` (`account_type_id`),
  ADD KEY `accounts_created_by_index` (`created_by`);

--
-- Indexes for table `account_transactions`
--
ALTER TABLE `account_transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `account_transactions_account_id_index` (`account_id`),
  ADD KEY `account_transactions_transaction_id_index` (`transaction_id`),
  ADD KEY `account_transactions_transaction_payment_id_index` (`transaction_payment_id`),
  ADD KEY `account_transactions_transfer_transaction_id_index` (`transfer_transaction_id`),
  ADD KEY `account_transactions_created_by_index` (`created_by`),
  ADD KEY `account_transactions_type_index` (`type`),
  ADD KEY `account_transactions_sub_type_index` (`sub_type`),
  ADD KEY `account_transactions_operation_date_index` (`operation_date`),
  ADD KEY `idx_account_transactions_account_date` (`account_id`,`operation_date`),
  ADD KEY `idx_account_transactions_operation_date` (`operation_date`);

--
-- Indexes for table `account_types`
--
ALTER TABLE `account_types`
  ADD PRIMARY KEY (`id`),
  ADD KEY `account_types_parent_account_type_id_index` (`parent_account_type_id`),
  ADD KEY `account_types_business_id_index` (`business_id`);

--
-- Indexes for table `activity_log`
--
ALTER TABLE `activity_log`
  ADD PRIMARY KEY (`id`),
  ADD KEY `activity_log_log_name_index` (`log_name`);

--
-- Indexes for table `advanced_report_configurations`
--
ALTER TABLE `advanced_report_configurations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `arc_type_active_idx` (`report_type`,`is_active`);

--
-- Indexes for table `advanced_report_exports`
--
ALTER TABLE `advanced_report_exports`
  ADD PRIMARY KEY (`id`),
  ADD KEY `are_biz_status_idx` (`business_id`,`status`),
  ADD KEY `are_created_status_idx` (`created_at`,`status`);

--
-- Indexes for table `advanced_report_saved_filters`
--
ALTER TABLE `advanced_report_saved_filters`
  ADD PRIMARY KEY (`id`),
  ADD KEY `advanced_report_saved_filters_user_id_foreign` (`user_id`),
  ADD KEY `arsf_biz_user_type_idx` (`business_id`,`user_id`,`report_type`);

--
-- Indexes for table `advanced_report_schedules`
--
ALTER TABLE `advanced_report_schedules`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ars_biz_active_idx` (`business_id`,`is_active`),
  ADD KEY `ars_next_run_idx` (`next_run_at`);

--
-- Indexes for table `aiassistance_history`
--
ALTER TABLE `aiassistance_history`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `ar_audit_log`
--
ALTER TABLE `ar_audit_log`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ar_audit_log_user_id_foreign` (`user_id`),
  ADD KEY `ar_audit_log_business_id_entity_type_entity_id_index` (`business_id`,`entity_type`,`entity_id`),
  ADD KEY `ar_audit_log_business_id_user_id_created_at_index` (`business_id`,`user_id`,`created_at`),
  ADD KEY `ar_audit_log_business_id_action_type_created_at_index` (`business_id`,`action_type`,`created_at`);

--
-- Indexes for table `ar_bank_accounts`
--
ALTER TABLE `ar_bank_accounts`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ar_bank_accounts_business_id_account_name_unique` (`business_id`,`account_name`),
  ADD KEY `ar_bank_accounts_created_by_foreign` (`created_by`),
  ADD KEY `ar_bank_accounts_business_id_is_active_index` (`business_id`,`is_active`),
  ADD KEY `ar_bank_accounts_business_id_account_type_index` (`business_id`,`account_type`),
  ADD KEY `ar_bank_accounts_linked_account_id_index` (`linked_account_id`),
  ADD KEY `ar_bank_accounts_opening_balance_transaction_id_index` (`opening_balance_transaction_id`);

--
-- Indexes for table `ar_bank_reconciliation`
--
ALTER TABLE `ar_bank_reconciliation`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ar_bank_recon_jel_unique` (`journal_entry_line_id`),
  ADD KEY `ar_bank_reconciliation_account_id_foreign` (`account_id`),
  ADD KEY `ar_bank_reconciliation_cleared_by_foreign` (`cleared_by`),
  ADD KEY `ar_bank_recon_cleared_idx` (`business_id`,`account_id`,`is_cleared`),
  ADD KEY `ar_bank_recon_date_idx` (`business_id`,`account_id`,`transaction_date`),
  ADD KEY `ar_bank_reconciliation_account_transaction_id_index` (`account_transaction_id`);

--
-- Indexes for table `ar_budgets`
--
ALTER TABLE `ar_budgets`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ar_budgets_business_id_fiscal_year_index` (`business_id`,`fiscal_year`),
  ADD KEY `ar_budgets_account_id_fiscal_year_index` (`account_id`,`fiscal_year`),
  ADD KEY `ar_budgets_location_id_index` (`location_id`);

--
-- Indexes for table `ar_capital_accounts`
--
ALTER TABLE `ar_capital_accounts`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ar_capital_accounts_business_id_account_name_unique` (`business_id`,`account_name`),
  ADD KEY `ar_capital_accounts_created_by_foreign` (`created_by`),
  ADD KEY `ar_capital_accounts_business_id_is_active_index` (`business_id`,`is_active`),
  ADD KEY `ar_capital_accounts_account_type_index` (`account_type`);

--
-- Indexes for table `ar_chart_of_accounts`
--
ALTER TABLE `ar_chart_of_accounts`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ar_chart_of_accounts_business_id_code_unique` (`business_id`,`code`),
  ADD KEY `ar_chart_of_accounts_account_id_foreign` (`account_id`),
  ADD KEY `ar_chart_of_accounts_created_by_foreign` (`created_by`),
  ADD KEY `ar_chart_of_accounts_updated_by_foreign` (`updated_by`),
  ADD KEY `ar_chart_of_accounts_business_id_account_group_index` (`business_id`,`account_group`),
  ADD KEY `ar_chart_of_accounts_business_id_account_type_index` (`business_id`,`account_type`),
  ADD KEY `ar_chart_of_accounts_business_id_code_index` (`business_id`,`code`),
  ADD KEY `ar_chart_of_accounts_parent_id_index` (`parent_id`);

--
-- Indexes for table `ar_cheque_books`
--
ALTER TABLE `ar_cheque_books`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ar_cheque_books_account_id_foreign` (`account_id`),
  ADD KEY `ar_cheque_books_location_id_foreign` (`location_id`),
  ADD KEY `ar_cheque_books_created_by_foreign` (`created_by`),
  ADD KEY `cheque_books_business_account_status_idx` (`business_id`,`account_id`,`status`),
  ADD KEY `cheque_books_range_idx` (`business_id`,`account_id`,`start_cheque_no`);

--
-- Indexes for table `ar_cheque_book_entries`
--
ALTER TABLE `ar_cheque_book_entries`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ar_cbe_unique` (`business_id`,`account_id`,`cheque_number`),
  ADD KEY `ar_cheque_book_entries_account_id_foreign` (`account_id`),
  ADD KEY `ar_cheque_book_entries_transaction_id_foreign` (`transaction_id`),
  ADD KEY `ar_cheque_book_entries_transaction_payment_id_foreign` (`transaction_payment_id`),
  ADD KEY `ar_cheque_book_entries_location_id_foreign` (`location_id`),
  ADD KEY `ar_cheque_book_entries_created_by_foreign` (`created_by`),
  ADD KEY `ar_cbe_status_idx` (`business_id`,`account_id`,`status`),
  ADD KEY `ar_cbe_date_idx` (`business_id`,`account_id`,`cheque_date`),
  ADD KEY `ar_cbe_cheque_idx` (`cheque_number`,`account_id`),
  ADD KEY `ar_cheque_book_entries_cheque_book_id_cheque_no_index` (`cheque_book_id`,`cheque_number`),
  ADD KEY `ar_cheque_book_entries_bank_account_id_index` (`bank_account_id`),
  ADD KEY `ar_cheque_book_entries_account_transaction_id_foreign` (`account_transaction_id`),
  ADD KEY `ar_cbe_source_cheque_idx` (`source_cheque_id`),
  ADD KEY `ar_cbe_contact_idx` (`contact_id`),
  ADD KEY `ar_cbe_deposit_account_idx` (`deposit_account_id`);

--
-- Indexes for table `ar_direct_expenses`
--
ALTER TABLE `ar_direct_expenses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ar_direct_expenses_payment_account_id_foreign` (`payment_account_id`),
  ADD KEY `ar_direct_expenses_created_by_foreign` (`created_by`),
  ADD KEY `ar_direct_expenses_business_id_expense_date_index` (`business_id`,`expense_date`),
  ADD KEY `ar_direct_expenses_location_id_index` (`location_id`),
  ADD KEY `ar_direct_expenses_account_id_index` (`account_id`);

--
-- Indexes for table `ar_direct_expense_names`
--
ALTER TABLE `ar_direct_expense_names`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ar_direct_expense_names_business_id_name_unique` (`business_id`,`name`),
  ADD KEY `ar_direct_expense_names_created_by_foreign` (`created_by`),
  ADD KEY `ar_direct_expense_names_business_id_is_active_index` (`business_id`,`is_active`);

--
-- Indexes for table `ar_direct_incomes`
--
ALTER TABLE `ar_direct_incomes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ar_direct_incomes_payment_account_id_foreign` (`payment_account_id`),
  ADD KEY `ar_direct_incomes_created_by_foreign` (`created_by`),
  ADD KEY `ar_direct_incomes_business_id_income_date_index` (`business_id`,`income_date`),
  ADD KEY `ar_direct_incomes_location_id_index` (`location_id`),
  ADD KEY `ar_direct_incomes_account_id_index` (`account_id`);

--
-- Indexes for table `ar_direct_income_names`
--
ALTER TABLE `ar_direct_income_names`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ar_direct_income_names_business_id_name_unique` (`business_id`,`name`),
  ADD KEY `ar_direct_income_names_created_by_foreign` (`created_by`),
  ADD KEY `ar_direct_income_names_business_id_is_active_index` (`business_id`,`is_active`);

--
-- Indexes for table `ar_fifo_layers`
--
ALTER TABLE `ar_fifo_layers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ar_fifo_layers_product_id_foreign` (`product_id`),
  ADD KEY `ar_fifo_layers_variation_id_foreign` (`variation_id`),
  ADD KEY `ar_fifo_layers_location_id_foreign` (`location_id`),
  ADD KEY `ar_fifo_layers_transaction_id_foreign` (`transaction_id`),
  ADD KEY `ar_fifo_layers_main_idx` (`business_id`,`product_id`,`variation_id`,`location_id`,`status`),
  ADD KEY `ar_fifo_layers_date_idx` (`business_id`,`location_id`,`layer_date`),
  ADD KEY `ar_fifo_layers_trans_idx` (`business_id`,`transaction_id`);

--
-- Indexes for table `ar_fixed_assets`
--
ALTER TABLE `ar_fixed_assets`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ar_fixed_assets_business_id_name_unique` (`business_id`,`name`),
  ADD KEY `ar_fixed_assets_created_by_foreign` (`created_by`),
  ADD KEY `ar_fixed_assets_business_id_is_active_index` (`business_id`,`is_active`);

--
-- Indexes for table `ar_fixed_asset_revaluations`
--
ALTER TABLE `ar_fixed_asset_revaluations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ar_fixed_asset_revaluations_business_id_foreign` (`business_id`),
  ADD KEY `ar_fixed_asset_revaluations_created_by_foreign` (`created_by`),
  ADD KEY `ar_fixed_asset_revaluations_fixed_asset_id_business_id_index` (`fixed_asset_id`,`business_id`),
  ADD KEY `ar_fixed_asset_revaluations_revaluation_date_index` (`revaluation_date`);

--
-- Indexes for table `ar_investments`
--
ALTER TABLE `ar_investments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ar_investments_business_id_name_unique` (`business_id`,`name`),
  ADD KEY `ar_investments_created_by_foreign` (`created_by`),
  ADD KEY `ar_investments_business_id_is_active_index` (`business_id`,`is_active`);

--
-- Indexes for table `ar_journal_entry_headers`
--
ALTER TABLE `ar_journal_entry_headers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ar_jeh_voucher_unique` (`business_id`,`voucher_no`),
  ADD KEY `ar_journal_entry_headers_source_transaction_id_foreign` (`source_transaction_id`),
  ADD KEY `ar_journal_entry_headers_location_id_foreign` (`location_id`),
  ADD KEY `ar_journal_entry_headers_created_by_foreign` (`created_by`),
  ADD KEY `ar_journal_entry_headers_posted_by_foreign` (`posted_by`),
  ADD KEY `ar_jeh_date_idx` (`business_id`,`voucher_date`),
  ADD KEY `ar_jeh_source_idx` (`business_id`,`source_module`,`source_transaction_id`),
  ADD KEY `ar_jeh_loc_date_idx` (`business_id`,`location_id`,`voucher_date`),
  ADD KEY `ar_jeh_status_idx` (`status`);

--
-- Indexes for table `ar_journal_entry_lines`
--
ALTER TABLE `ar_journal_entry_lines`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ar_journal_entry_lines_account_id_foreign` (`account_id`),
  ADD KEY `ar_journal_entry_lines_contact_id_foreign` (`contact_id`),
  ADD KEY `ar_journal_entry_lines_product_id_foreign` (`product_id`),
  ADD KEY `ar_journal_entry_lines_variation_id_foreign` (`variation_id`),
  ADD KEY `ar_journal_entry_lines_tax_id_foreign` (`tax_id`),
  ADD KEY `ar_jel_account_idx` (`business_id`,`account_id`),
  ADD KEY `ar_jel_contact_idx` (`business_id`,`contact_id`),
  ADD KEY `ar_jel_product_idx` (`business_id`,`product_id`),
  ADD KEY `ar_jel_entry_idx` (`journal_entry_id`,`line_number`),
  ADD KEY `ar_jel_account_date_idx` (`business_id`,`account_id`,`created_at`);

--
-- Indexes for table `ar_ledger_rollups`
--
ALTER TABLE `ar_ledger_rollups`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ar_ledger_rollup_unique` (`business_id`,`account_id`,`period_date`,`period_type`,`location_id`),
  ADD KEY `ar_ledger_rollups_account_id_foreign` (`account_id`),
  ADD KEY `ar_ledger_rollups_location_id_foreign` (`location_id`),
  ADD KEY `ar_rollup_account_date_idx` (`business_id`,`account_id`,`period_date`),
  ADD KEY `ar_rollup_period_idx` (`business_id`,`period_date`,`period_type`);

--
-- Indexes for table `ar_loans`
--
ALTER TABLE `ar_loans`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ar_loans_loan_number_unique` (`loan_number`),
  ADD KEY `ar_loans_liability_account_id_foreign` (`liability_account_id`),
  ADD KEY `ar_loans_payment_account_id_foreign` (`payment_account_id`),
  ADD KEY `ar_loans_location_id_foreign` (`location_id`),
  ADD KEY `ar_loans_created_by_foreign` (`created_by`),
  ADD KEY `ar_loans_business_id_loan_date_index` (`business_id`,`loan_date`),
  ADD KEY `ar_loans_business_id_status_index` (`business_id`,`status`),
  ADD KEY `ar_loans_loan_number_index` (`loan_number`);

--
-- Indexes for table `ar_loan_transactions`
--
ALTER TABLE `ar_loan_transactions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ar_loan_transactions_transaction_number_unique` (`transaction_number`),
  ADD KEY `ar_loan_transactions_payment_account_id_foreign` (`payment_account_id`),
  ADD KEY `ar_loan_transactions_account_transaction_id_foreign` (`account_transaction_id`),
  ADD KEY `ar_loan_transactions_created_by_foreign` (`created_by`),
  ADD KEY `ar_loan_transactions_loan_id_transaction_date_index` (`loan_id`,`transaction_date`),
  ADD KEY `ar_loan_transactions_business_id_transaction_type_index` (`business_id`,`transaction_type`),
  ADD KEY `ar_loan_transactions_transaction_number_index` (`transaction_number`);

--
-- Indexes for table `ar_period_locks`
--
ALTER TABLE `ar_period_locks`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ar_period_locks_business_id_period_start_period_end_unique` (`business_id`,`period_start`,`period_end`),
  ADD KEY `ar_period_locks_locked_by_foreign` (`locked_by`),
  ADD KEY `ar_period_locks_unlocked_by_foreign` (`unlocked_by`),
  ADD KEY `ar_period_locks_business_id_is_locked_index` (`business_id`,`is_locked`);

--
-- Indexes for table `ar_ratio_snapshots`
--
ALTER TABLE `ar_ratio_snapshots`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ar_ratio_snapshots_business_id_snapshot_date_period_type_unique` (`business_id`,`snapshot_date`,`period_type`),
  ADD KEY `ar_ratio_snapshots_business_id_snapshot_date_index` (`business_id`,`snapshot_date`);

--
-- Indexes for table `ar_receivables_payables`
--
ALTER TABLE `ar_receivables_payables`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ar_receivables_payables_contact_id_foreign` (`contact_id`),
  ADD KEY `ar_receivables_payables_transaction_id_foreign` (`transaction_id`),
  ADD KEY `ar_receivables_payables_journal_entry_id_foreign` (`journal_entry_id`),
  ADD KEY `ar_arp_contact_status_idx` (`business_id`,`contact_id`,`type`,`status`),
  ADD KEY `ar_arp_doc_date_idx` (`business_id`,`type`,`document_date`),
  ADD KEY `ar_arp_aging_idx` (`business_id`,`type`,`days_past_due`),
  ADD KEY `ar_arp_trans_idx` (`business_id`,`transaction_id`);

--
-- Indexes for table `assets`
--
ALTER TABLE `assets`
  ADD PRIMARY KEY (`id`),
  ADD KEY `assets_business_id_foreign` (`business_id`),
  ADD KEY `assets_category_id_foreign` (`category_id`),
  ADD KEY `assets_created_by_foreign` (`created_by`);

--
-- Indexes for table `asset_maintenances`
--
ALTER TABLE `asset_maintenances`
  ADD PRIMARY KEY (`id`),
  ADD KEY `asset_maintenances_business_id_index` (`business_id`),
  ADD KEY `asset_maintenances_asset_id_index` (`asset_id`),
  ADD KEY `asset_maintenances_status_index` (`status`),
  ADD KEY `asset_maintenances_priority_index` (`priority`),
  ADD KEY `asset_maintenances_created_by_index` (`created_by`),
  ADD KEY `asset_maintenances_assigned_to_index` (`assigned_to`);

--
-- Indexes for table `asset_transactions`
--
ALTER TABLE `asset_transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `asset_transactions_business_id_foreign` (`business_id`),
  ADD KEY `asset_transactions_asset_id_foreign` (`asset_id`),
  ADD KEY `asset_transactions_receiver_foreign` (`receiver`),
  ADD KEY `asset_transactions_parent_id_foreign` (`parent_id`),
  ADD KEY `asset_transactions_created_by_foreign` (`created_by`);

--
-- Indexes for table `asset_warranties`
--
ALTER TABLE `asset_warranties`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `award_catalog`
--
ALTER TABLE `award_catalog`
  ADD PRIMARY KEY (`id`),
  ADD KEY `award_catalog_product_id_foreign` (`product_id`),
  ADD KEY `award_catalog_business_id_is_active_index` (`business_id`,`is_active`);

--
-- Indexes for table `award_periods`
--
ALTER TABLE `award_periods`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ap_business_period_start_unique` (`business_id`,`period_type`,`period_start`),
  ADD KEY `award_periods_finalized_by_foreign` (`finalized_by`),
  ADD KEY `ap_business_period_finalized_idx` (`business_id`,`period_type`,`is_finalized`);

--
-- Indexes for table `backup_logs`
--
ALTER TABLE `backup_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `backup_logs_user_id_foreign` (`user_id`),
  ADD KEY `backup_logs_business_id_index` (`business_id`),
  ADD KEY `backup_logs_backup_id_index` (`backup_id`),
  ADD KEY `backup_logs_action_index` (`action`),
  ADD KEY `backup_logs_status_index` (`status`),
  ADD KEY `backup_logs_created_at_index` (`created_at`);

--
-- Indexes for table `barcodes`
--
ALTER TABLE `barcodes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `barcodes_business_id_foreign` (`business_id`);

--
-- Indexes for table `bookings`
--
ALTER TABLE `bookings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `bookings_contact_id_foreign` (`contact_id`),
  ADD KEY `bookings_business_id_foreign` (`business_id`),
  ADD KEY `bookings_created_by_foreign` (`created_by`),
  ADD KEY `bookings_table_id_index` (`table_id`),
  ADD KEY `bookings_waiter_id_index` (`waiter_id`),
  ADD KEY `bookings_location_id_index` (`location_id`),
  ADD KEY `bookings_booking_status_index` (`booking_status`),
  ADD KEY `bookings_correspondent_id_index` (`correspondent_id`);

--
-- Indexes for table `brands`
--
ALTER TABLE `brands`
  ADD PRIMARY KEY (`id`),
  ADD KEY `brands_business_id_foreign` (`business_id`),
  ADD KEY `brands_created_by_foreign` (`created_by`);

--
-- Indexes for table `business_backups`
--
ALTER TABLE `business_backups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `business_backups_created_by_foreign` (`created_by`),
  ADD KEY `business_backups_business_id_index` (`business_id`),
  ADD KEY `business_backups_status_index` (`status`);

--
-- Indexes for table `business_locations`
--
ALTER TABLE `business_locations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `business_locations_business_id_index` (`business_id`),
  ADD KEY `business_locations_invoice_scheme_id_foreign` (`invoice_scheme_id`),
  ADD KEY `business_locations_invoice_layout_id_foreign` (`invoice_layout_id`),
  ADD KEY `business_locations_sale_invoice_layout_id_index` (`sale_invoice_layout_id`),
  ADD KEY `business_locations_selling_price_group_id_index` (`selling_price_group_id`),
  ADD KEY `business_locations_receipt_printer_type_index` (`receipt_printer_type`),
  ADD KEY `business_locations_printer_id_index` (`printer_id`);

--
-- Indexes for table `business_management_audit_logs`
--
ALTER TABLE `business_management_audit_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `business_management_audit_logs_user_id_created_at_index` (`user_id`,`created_at`),
  ADD KEY `business_management_audit_logs_business_id_created_at_index` (`business_id`,`created_at`),
  ADD KEY `business_management_audit_logs_action_created_at_index` (`action`,`created_at`),
  ADD KEY `business_management_audit_logs_level_created_at_index` (`level`,`created_at`),
  ADD KEY `business_management_audit_logs_report_type_created_at_index` (`report_type`,`created_at`),
  ADD KEY `business_management_audit_logs_action_index` (`action`),
  ADD KEY `business_management_audit_logs_user_id_index` (`user_id`),
  ADD KEY `business_management_audit_logs_report_type_index` (`report_type`),
  ADD KEY `business_management_audit_logs_level_index` (`level`),
  ADD KEY `business_management_audit_logs_business_id_index` (`business_id`);

--
-- Indexes for table `cash_denominations`
--
ALTER TABLE `cash_denominations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cash_denominations_model_type_model_id_index` (`model_type`,`model_id`);

--
-- Indexes for table `cash_registers`
--
ALTER TABLE `cash_registers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cash_registers_business_id_foreign` (`business_id`),
  ADD KEY `cash_registers_user_id_foreign` (`user_id`),
  ADD KEY `cash_registers_location_id_index` (`location_id`);

--
-- Indexes for table `cash_register_transactions`
--
ALTER TABLE `cash_register_transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cash_register_transactions_cash_register_id_foreign` (`cash_register_id`),
  ADD KEY `cash_register_transactions_transaction_id_index` (`transaction_id`),
  ADD KEY `cash_register_transactions_type_index` (`type`),
  ADD KEY `cash_register_transactions_transaction_type_index` (`transaction_type`);

--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `categories_business_id_foreign` (`business_id`),
  ADD KEY `categories_created_by_foreign` (`created_by`),
  ADD KEY `categories_parent_id_index` (`parent_id`),
  ADD KEY `categories_woocommerce_cat_id_index` (`woocommerce_cat_id`);

--
-- Indexes for table `categorizables`
--
ALTER TABLE `categorizables`
  ADD KEY `categorizables_categorizable_type_categorizable_id_index` (`categorizable_type`,`categorizable_id`);

--
-- Indexes for table `cms_pages`
--
ALTER TABLE `cms_pages`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `cms_page_metas`
--
ALTER TABLE `cms_page_metas`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cms_page_metas_cms_page_id_foreign` (`cms_page_id`);

--
-- Indexes for table `cms_site_details`
--
ALTER TABLE `cms_site_details`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `contacts`
--
ALTER TABLE `contacts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `contacts_business_id_foreign` (`business_id`),
  ADD KEY `contacts_created_by_foreign` (`created_by`),
  ADD KEY `contacts_type_index` (`type`),
  ADD KEY `contacts_contact_status_index` (`contact_status`),
  ADD KEY `contacts_crm_source_index` (`crm_source`),
  ADD KEY `contacts_crm_life_stage_index` (`crm_life_stage`),
  ADD KEY `contacts_converted_by_index` (`converted_by`),
  ADD KEY `idx_contacts_business_type` (`business_id`,`type`);

--
-- Indexes for table `crm_call_logs`
--
ALTER TABLE `crm_call_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `crm_call_logs_business_id_index` (`business_id`),
  ADD KEY `crm_call_logs_user_id_index` (`user_id`),
  ADD KEY `crm_call_logs_contact_id_index` (`contact_id`),
  ADD KEY `crm_call_logs_created_by_index` (`created_by`);

--
-- Indexes for table `crm_campaigns`
--
ALTER TABLE `crm_campaigns`
  ADD PRIMARY KEY (`id`),
  ADD KEY `crm_campaigns_business_id_foreign` (`business_id`),
  ADD KEY `crm_campaigns_created_by_index` (`created_by`);

--
-- Indexes for table `crm_contact_person_commissions`
--
ALTER TABLE `crm_contact_person_commissions`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `crm_lead_users`
--
ALTER TABLE `crm_lead_users`
  ADD PRIMARY KEY (`id`),
  ADD KEY `crm_lead_users_user_id_index` (`user_id`),
  ADD KEY `crm_lead_users_contact_id_index` (`contact_id`);

--
-- Indexes for table `crm_marketplaces`
--
ALTER TABLE `crm_marketplaces`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `crm_proposals`
--
ALTER TABLE `crm_proposals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `crm_proposals_business_id_foreign` (`business_id`),
  ADD KEY `crm_proposals_contact_id_foreign` (`contact_id`),
  ADD KEY `crm_proposals_sent_by_index` (`sent_by`);

--
-- Indexes for table `crm_proposal_templates`
--
ALTER TABLE `crm_proposal_templates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `crm_proposal_templates_business_id_foreign` (`business_id`),
  ADD KEY `crm_proposal_templates_created_by_index` (`created_by`);

--
-- Indexes for table `crm_schedules`
--
ALTER TABLE `crm_schedules`
  ADD PRIMARY KEY (`id`),
  ADD KEY `crm_schedules_created_by_index` (`created_by`),
  ADD KEY `crm_schedules_business_id_index` (`business_id`),
  ADD KEY `crm_schedules_contact_id_index` (`contact_id`),
  ADD KEY `crm_schedules_schedule_type_index` (`schedule_type`),
  ADD KEY `crm_schedules_notify_type_index` (`notify_type`);

--
-- Indexes for table `crm_schedule_logs`
--
ALTER TABLE `crm_schedule_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `crm_schedule_logs_schedule_id_foreign` (`schedule_id`),
  ADD KEY `crm_schedule_logs_created_by_index` (`created_by`);

--
-- Indexes for table `crm_schedule_users`
--
ALTER TABLE `crm_schedule_users`
  ADD PRIMARY KEY (`id`),
  ADD KEY `crm_schedule_users_schedule_id_foreign` (`schedule_id`),
  ADD KEY `crm_schedule_users_user_id_index` (`user_id`);

--
-- Indexes for table `currencies`
--
ALTER TABLE `currencies`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `customer_awards`
--
ALTER TABLE `customer_awards`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ca_business_customer_period_unique` (`business_id`,`customer_id`,`period_type`,`period_start`),
  ADD KEY `customer_awards_customer_id_foreign` (`customer_id`),
  ADD KEY `customer_awards_period_id_foreign` (`period_id`),
  ADD KEY `customer_awards_catalog_item_id_foreign` (`catalog_item_id`),
  ADD KEY `customer_awards_awarded_by_foreign` (`awarded_by`),
  ADD KEY `ca_business_period_rank_idx` (`business_id`,`period_type`,`rank_position`),
  ADD KEY `ca_business_awarded_idx` (`business_id`,`is_awarded`);

--
-- Indexes for table `customer_engagements`
--
ALTER TABLE `customer_engagements`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customer_engagements_customer_id_foreign` (`customer_id`),
  ADD KEY `customer_engagements_recorded_by_foreign` (`recorded_by`),
  ADD KEY `customer_engagements_business_id_customer_id_index` (`business_id`,`customer_id`),
  ADD KEY `customer_engagements_business_id_recorded_date_index` (`business_id`,`recorded_date`);

--
-- Indexes for table `customer_groups`
--
ALTER TABLE `customer_groups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customer_groups_business_id_foreign` (`business_id`),
  ADD KEY `customer_groups_created_by_index` (`created_by`),
  ADD KEY `customer_groups_price_calculation_type_index` (`price_calculation_type`),
  ADD KEY `customer_groups_selling_price_group_id_index` (`selling_price_group_id`);

--
-- Indexes for table `customer_recognition_cache`
--
ALTER TABLE `customer_recognition_cache`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `crc_business_customer_period_unique` (`business_id`,`customer_id`,`period_type`,`period_start`),
  ADD KEY `customer_recognition_cache_customer_id_foreign` (`customer_id`),
  ADD KEY `crc_business_period_score_idx` (`business_id`,`period_type`,`final_score`);

--
-- Indexes for table `customer_recognition_settings`
--
ALTER TABLE `customer_recognition_settings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `customer_recognition_settings_business_id_unique` (`business_id`);

--
-- Indexes for table `dashboard_configurations`
--
ALTER TABLE `dashboard_configurations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `dashboard_configurations_business_id_foreign` (`business_id`);

--
-- Indexes for table `discounts`
--
ALTER TABLE `discounts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `discounts_business_id_index` (`business_id`),
  ADD KEY `discounts_brand_id_index` (`brand_id`),
  ADD KEY `discounts_category_id_index` (`category_id`),
  ADD KEY `discounts_location_id_index` (`location_id`),
  ADD KEY `discounts_priority_index` (`priority`),
  ADD KEY `discounts_spg_index` (`spg`);

--
-- Indexes for table `discount_variations`
--
ALTER TABLE `discount_variations`
  ADD KEY `discount_variations_discount_id_index` (`discount_id`),
  ADD KEY `discount_variations_variation_id_index` (`variation_id`);

--
-- Indexes for table `document_and_notes`
--
ALTER TABLE `document_and_notes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `document_and_notes_business_id_index` (`business_id`),
  ADD KEY `document_and_notes_notable_id_index` (`notable_id`),
  ADD KEY `document_and_notes_created_by_index` (`created_by`);

--
-- Indexes for table `essentials_allowances_and_deductions`
--
ALTER TABLE `essentials_allowances_and_deductions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `essentials_allowances_and_deductions_business_id_index` (`business_id`);

--
-- Indexes for table `essentials_attendances`
--
ALTER TABLE `essentials_attendances`
  ADD PRIMARY KEY (`id`),
  ADD KEY `essentials_attendances_user_id_index` (`user_id`),
  ADD KEY `essentials_attendances_business_id_index` (`business_id`),
  ADD KEY `essentials_attendances_essentials_shift_id_index` (`essentials_shift_id`);

--
-- Indexes for table `essentials_documents`
--
ALTER TABLE `essentials_documents`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `essentials_document_shares`
--
ALTER TABLE `essentials_document_shares`
  ADD PRIMARY KEY (`id`),
  ADD KEY `essentials_document_shares_document_id_index` (`document_id`),
  ADD KEY `essentials_document_shares_value_type_index` (`value_type`);

--
-- Indexes for table `essentials_holidays`
--
ALTER TABLE `essentials_holidays`
  ADD PRIMARY KEY (`id`),
  ADD KEY `essentials_holidays_business_id_index` (`business_id`),
  ADD KEY `essentials_holidays_location_id_index` (`location_id`);

--
-- Indexes for table `essentials_kb`
--
ALTER TABLE `essentials_kb`
  ADD PRIMARY KEY (`id`),
  ADD KEY `essentials_kb_business_id_index` (`business_id`),
  ADD KEY `essentials_kb_parent_id_index` (`parent_id`),
  ADD KEY `essentials_kb_created_by_index` (`created_by`);

--
-- Indexes for table `essentials_kb_users`
--
ALTER TABLE `essentials_kb_users`
  ADD PRIMARY KEY (`id`),
  ADD KEY `essentials_kb_users_kb_id_index` (`kb_id`),
  ADD KEY `essentials_kb_users_user_id_index` (`user_id`);

--
-- Indexes for table `essentials_leaves`
--
ALTER TABLE `essentials_leaves`
  ADD PRIMARY KEY (`id`),
  ADD KEY `essentials_leaves_essentials_leave_type_id_index` (`essentials_leave_type_id`),
  ADD KEY `essentials_leaves_business_id_index` (`business_id`),
  ADD KEY `essentials_leaves_user_id_index` (`user_id`);

--
-- Indexes for table `essentials_leave_types`
--
ALTER TABLE `essentials_leave_types`
  ADD PRIMARY KEY (`id`),
  ADD KEY `essentials_leave_types_business_id_index` (`business_id`);

--
-- Indexes for table `essentials_messages`
--
ALTER TABLE `essentials_messages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `essentials_messages_business_id_index` (`business_id`),
  ADD KEY `essentials_messages_user_id_index` (`user_id`),
  ADD KEY `essentials_messages_location_id_index` (`location_id`);

--
-- Indexes for table `essentials_payroll_groups`
--
ALTER TABLE `essentials_payroll_groups`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `essentials_payroll_group_transactions`
--
ALTER TABLE `essentials_payroll_group_transactions`
  ADD KEY `essentials_payroll_group_transactions_payroll_group_id_foreign` (`payroll_group_id`);

--
-- Indexes for table `essentials_reminders`
--
ALTER TABLE `essentials_reminders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `essentials_reminders_business_id_index` (`business_id`),
  ADD KEY `essentials_reminders_user_id_index` (`user_id`);

--
-- Indexes for table `essentials_shifts`
--
ALTER TABLE `essentials_shifts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `essentials_shifts_type_index` (`type`),
  ADD KEY `essentials_shifts_business_id_index` (`business_id`);

--
-- Indexes for table `essentials_todo_comments`
--
ALTER TABLE `essentials_todo_comments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `essentials_todo_comments_task_id_index` (`task_id`),
  ADD KEY `essentials_todo_comments_comment_by_index` (`comment_by`);

--
-- Indexes for table `essentials_to_dos`
--
ALTER TABLE `essentials_to_dos`
  ADD PRIMARY KEY (`id`),
  ADD KEY `essentials_to_dos_status_index` (`status`),
  ADD KEY `essentials_to_dos_priority_index` (`priority`),
  ADD KEY `essentials_to_dos_created_by_index` (`created_by`),
  ADD KEY `essentials_to_dos_business_id_index` (`business_id`),
  ADD KEY `essentials_to_dos_task_id_index` (`task_id`);

--
-- Indexes for table `essentials_user_allowance_and_deductions`
--
ALTER TABLE `essentials_user_allowance_and_deductions`
  ADD KEY `essentials_user_allowance_and_deductions_user_id_index` (`user_id`),
  ADD KEY `allow_deduct_index` (`allowance_deduction_id`);

--
-- Indexes for table `essentials_user_sales_targets`
--
ALTER TABLE `essentials_user_sales_targets`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `essentials_user_shifts`
--
ALTER TABLE `essentials_user_shifts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `essentials_user_shifts_user_id_index` (`user_id`),
  ADD KEY `essentials_user_shifts_essentials_shift_id_index` (`essentials_shift_id`);

--
-- Indexes for table `expense_categories`
--
ALTER TABLE `expense_categories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `expense_categories_business_id_foreign` (`business_id`);

--
-- Indexes for table `field_forces`
--
ALTER TABLE `field_forces`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `group_sub_taxes`
--
ALTER TABLE `group_sub_taxes`
  ADD KEY `group_sub_taxes_group_tax_id_foreign` (`group_tax_id`),
  ADD KEY `group_sub_taxes_tax_id_foreign` (`tax_id`);

--
-- Indexes for table `installments`
--
ALTER TABLE `installments`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `installment_db`
--
ALTER TABLE `installment_db`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `installment_systems`
--
ALTER TABLE `installment_systems`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `inventory`
--
ALTER TABLE `inventory`
  ADD PRIMARY KEY (`id`),
  ADD KEY `inventory_branch_id_foreign` (`branch_id`);

--
-- Indexes for table `inventory_products`
--
ALTER TABLE `inventory_products`
  ADD PRIMARY KEY (`id`),
  ADD KEY `inventory_products_inventory_id_foreign` (`inventory_id`),
  ADD KEY `inventory_products_product_id_foreign` (`product_id`),
  ADD KEY `inventory_products_transaction_id_foreign` (`transaction_id`),
  ADD KEY `inventory_products_variation_id_foreign` (`variation_id`);

--
-- Indexes for table `invoice_layouts`
--
ALTER TABLE `invoice_layouts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `invoice_layouts_business_id_foreign` (`business_id`);

--
-- Indexes for table `invoice_schemes`
--
ALTER TABLE `invoice_schemes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `invoice_schemes_business_id_foreign` (`business_id`),
  ADD KEY `invoice_schemes_scheme_type_index` (`scheme_type`),
  ADD KEY `invoice_schemes_number_type_index` (`number_type`);

--
-- Indexes for table `media`
--
ALTER TABLE `media`
  ADD PRIMARY KEY (`id`),
  ADD KEY `media_model_type_model_id_index` (`model_type`,`model_id`),
  ADD KEY `media_business_id_index` (`business_id`),
  ADD KEY `media_uploaded_by_index` (`uploaded_by`),
  ADD KEY `media_woocommerce_media_id_index` (`woocommerce_media_id`);

--
-- Indexes for table `mfg_ingredient_groups`
--
ALTER TABLE `mfg_ingredient_groups`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `mfg_recipes`
--
ALTER TABLE `mfg_recipes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `mfg_recipes_product_id_index` (`product_id`),
  ADD KEY `mfg_recipes_variation_id_index` (`variation_id`);

--
-- Indexes for table `mfg_recipe_ingredients`
--
ALTER TABLE `mfg_recipe_ingredients`
  ADD PRIMARY KEY (`id`),
  ADD KEY `mfg_recipe_ingredients_mfg_recipe_id_index` (`mfg_recipe_id`),
  ADD KEY `mfg_recipe_ingredients_variation_id_index` (`variation_id`),
  ADD KEY `mfg_recipe_ingredients_sub_unit_id_index` (`sub_unit_id`);

--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
  ADD KEY `model_has_permissions_model_type_model_id_index` (`model_type`,`model_id`);

--
-- Indexes for table `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD PRIMARY KEY (`role_id`,`model_id`,`model_type`),
  ADD KEY `model_has_roles_model_type_model_id_index` (`model_type`,`model_id`);

--
-- Indexes for table `module_licenses`
--
ALTER TABLE `module_licenses`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `module_licenses_license_code_unique` (`license_code`),
  ADD KEY `module_licenses_module_name_license_code_index` (`module_name`,`license_code`),
  ADD KEY `module_licenses_module_name_username_index` (`module_name`,`username`),
  ADD KEY `module_licenses_module_name_index` (`module_name`);

--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `notifications_notifiable_type_notifiable_id_index` (`notifiable_type`,`notifiable_id`);

--
-- Indexes for table `notification_templates`
--
ALTER TABLE `notification_templates`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `oauth_auth_codes`
--
ALTER TABLE `oauth_auth_codes`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `oauth_personal_access_clients`
--
ALTER TABLE `oauth_personal_access_clients`
  ADD PRIMARY KEY (`id`),
  ADD KEY `oauth_personal_access_clients_client_id_index` (`client_id`);

--
-- Indexes for table `packages`
--
ALTER TABLE `packages`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `pjt_invoice_lines`
--
ALTER TABLE `pjt_invoice_lines`
  ADD PRIMARY KEY (`id`),
  ADD KEY `pjt_invoice_lines_transaction_id_foreign` (`transaction_id`),
  ADD KEY `pjt_invoice_lines_tax_rate_id_index` (`tax_rate_id`);

--
-- Indexes for table `pjt_projects`
--
ALTER TABLE `pjt_projects`
  ADD PRIMARY KEY (`id`),
  ADD KEY `pjt_projects_business_id_index` (`business_id`),
  ADD KEY `pjt_projects_contact_id_index` (`contact_id`),
  ADD KEY `pjt_projects_lead_id_index` (`lead_id`),
  ADD KEY `pjt_projects_created_by_index` (`created_by`);

--
-- Indexes for table `pjt_project_members`
--
ALTER TABLE `pjt_project_members`
  ADD PRIMARY KEY (`id`),
  ADD KEY `pjt_project_members_project_id_foreign` (`project_id`),
  ADD KEY `pjt_project_members_user_id_index` (`user_id`);

--
-- Indexes for table `pjt_project_tasks`
--
ALTER TABLE `pjt_project_tasks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `pjt_project_tasks_project_id_foreign` (`project_id`),
  ADD KEY `pjt_project_tasks_business_id_index` (`business_id`),
  ADD KEY `pjt_project_tasks_created_by_index` (`created_by`);

--
-- Indexes for table `pjt_project_task_comments`
--
ALTER TABLE `pjt_project_task_comments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `pjt_project_task_comments_project_task_id_foreign` (`project_task_id`);

--
-- Indexes for table `pjt_project_task_members`
--
ALTER TABLE `pjt_project_task_members`
  ADD PRIMARY KEY (`id`),
  ADD KEY `pjt_project_task_members_project_task_id_foreign` (`project_task_id`),
  ADD KEY `pjt_project_task_members_user_id_index` (`user_id`);

--
-- Indexes for table `pjt_project_time_logs`
--
ALTER TABLE `pjt_project_time_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `pjt_project_time_logs_project_id_foreign` (`project_id`),
  ADD KEY `pjt_project_time_logs_project_task_id_foreign` (`project_task_id`),
  ADD KEY `pjt_project_time_logs_user_id_index` (`user_id`),
  ADD KEY `pjt_project_time_logs_created_by_index` (`created_by`);

--
-- Indexes for table `premade_lines`
--
ALTER TABLE `premade_lines`
  ADD PRIMARY KEY (`id`),
  ADD KEY `premade_lines_business_id_foreign` (`business_id`),
  ADD KEY `premade_lines_premade_product_id_foreign` (`premade_product_id`),
  ADD KEY `premade_lines_product_id_foreign` (`product_id`),
  ADD KEY `premade_lines_variation_id_foreign` (`variation_id`);

--
-- Indexes for table `printers`
--
ALTER TABLE `printers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `printers_business_id_foreign` (`business_id`);

--
-- Indexes for table `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`),
  ADD KEY `products_brand_id_foreign` (`brand_id`),
  ADD KEY `products_category_id_foreign` (`category_id`),
  ADD KEY `products_sub_category_id_foreign` (`sub_category_id`),
  ADD KEY `products_tax_foreign` (`tax`),
  ADD KEY `products_name_index` (`name`),
  ADD KEY `products_business_id_index` (`business_id`),
  ADD KEY `products_unit_id_index` (`unit_id`),
  ADD KEY `products_created_by_index` (`created_by`),
  ADD KEY `products_warranty_id_index` (`warranty_id`),
  ADD KEY `products_type_index` (`type`),
  ADD KEY `products_tax_type_index` (`tax_type`),
  ADD KEY `products_barcode_type_index` (`barcode_type`),
  ADD KEY `products_secondary_unit_id_index` (`secondary_unit_id`),
  ADD KEY `products_woocommerce_product_id_index` (`woocommerce_product_id`),
  ADD KEY `products_woocommerce_media_id_index` (`woocommerce_media_id`),
  ADD KEY `products_repair_model_id_index` (`repair_model_id`),
  ADD KEY `products_supplier_id_index` (`supplier_id`),
  ADD KEY `idx_products_business_category` (`business_id`,`category_id`);

--
-- Indexes for table `product_locations`
--
ALTER TABLE `product_locations`
  ADD KEY `product_locations_product_id_index` (`product_id`),
  ADD KEY `product_locations_location_id_index` (`location_id`);

--
-- Indexes for table `product_racks`
--
ALTER TABLE `product_racks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_racks_business_id_index` (`business_id`),
  ADD KEY `product_racks_location_id_index` (`location_id`),
  ADD KEY `product_racks_product_id_index` (`product_id`);

--
-- Indexes for table `product_variations`
--
ALTER TABLE `product_variations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_variations_name_index` (`name`),
  ADD KEY `product_variations_product_id_index` (`product_id`);

--
-- Indexes for table `promotions`
--
ALTER TABLE `promotions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `promotions_business_id_product_id_index` (`business_id`,`product_id`),
  ADD KEY `promotions_start_date_end_date_index` (`start_date`,`end_date`),
  ADD KEY `promotions_is_active_index` (`is_active`),
  ADD KEY `promotions_promotion_type_index` (`promotion_type`),
  ADD KEY `promotions_get_product_id_index` (`get_product_id`),
  ADD KEY `idx_business_type_active` (`business_id`,`promotion_type`,`is_active`),
  ADD KEY `idx_business_active_dates` (`business_id`,`is_active`,`start_date`,`end_date`),
  ADD KEY `idx_business_location` (`business_id`,`location_id`),
  ADD KEY `promotions_product_id_foreign` (`product_id`),
  ADD KEY `promotions_location_id_foreign` (`location_id`),
  ADD KEY `promotions_created_by_foreign` (`created_by`),
  ADD KEY `idx_product_lookup` (`business_id`,`product_id`,`variation_id`,`is_active`),
  ADD KEY `idx_location_lookup` (`business_id`,`location_id`,`is_active`);

--
-- Indexes for table `promotion_audit_logs`
--
ALTER TABLE `promotion_audit_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `promotion_audit_logs_promotion_id_created_at_index` (`promotion_id`,`created_at`),
  ADD KEY `promotion_audit_logs_user_id_created_at_index` (`user_id`,`created_at`),
  ADD KEY `promotion_audit_logs_action_index` (`action`);

--
-- Indexes for table `promotion_daily_usage`
--
ALTER TABLE `promotion_daily_usage`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `promotion_daily_usage_promotion_id_usage_date_unique` (`promotion_id`,`usage_date`),
  ADD KEY `promotion_daily_usage_promotion_id_index` (`promotion_id`),
  ADD KEY `promotion_daily_usage_usage_date_index` (`usage_date`);

--
-- Indexes for table `promotion_templates`
--
ALTER TABLE `promotion_templates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `promotion_templates_created_by_foreign` (`created_by`),
  ADD KEY `promotion_templates_business_id_promotion_type_index` (`business_id`,`promotion_type`);

--
-- Indexes for table `purchase_lines`
--
ALTER TABLE `purchase_lines`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_lines_transaction_id_foreign` (`transaction_id`),
  ADD KEY `purchase_lines_product_id_foreign` (`product_id`),
  ADD KEY `purchase_lines_variation_id_foreign` (`variation_id`),
  ADD KEY `purchase_lines_tax_id_foreign` (`tax_id`),
  ADD KEY `purchase_lines_sub_unit_id_index` (`sub_unit_id`),
  ADD KEY `purchase_lines_lot_number_index` (`lot_number`),
  ADD KEY `idx_pl_variation` (`variation_id`),
  ADD KEY `idx_purchase_lines_transaction` (`transaction_id`),
  ADD KEY `idx_purchase_lines_variation` (`variation_id`),
  ADD KEY `idx_purchase_lines_transaction_variation` (`transaction_id`,`variation_id`);

--
-- Indexes for table `reference_counts`
--
ALTER TABLE `reference_counts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `reference_counts_business_id_index` (`business_id`);

--
-- Indexes for table `repair_device_models`
--
ALTER TABLE `repair_device_models`
  ADD PRIMARY KEY (`id`),
  ADD KEY `repair_device_models_business_id_index` (`business_id`),
  ADD KEY `repair_device_models_brand_id_index` (`brand_id`),
  ADD KEY `repair_device_models_device_id_index` (`device_id`),
  ADD KEY `repair_device_models_created_by_index` (`created_by`);

--
-- Indexes for table `repair_statuses`
--
ALTER TABLE `repair_statuses`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `res_product_modifier_sets`
--
ALTER TABLE `res_product_modifier_sets`
  ADD KEY `res_product_modifier_sets_modifier_set_id_foreign` (`modifier_set_id`);

--
-- Indexes for table `res_tables`
--
ALTER TABLE `res_tables`
  ADD PRIMARY KEY (`id`),
  ADD KEY `res_tables_business_id_foreign` (`business_id`);

--
-- Indexes for table `return_groups`
--
ALTER TABLE `return_groups`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `rma_complain_receives`
--
ALTER TABLE `rma_complain_receives`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `rma_complain_receives_rma_number_unique` (`rma_number`),
  ADD KEY `rma_complain_receives_business_id_status_index` (`business_id`,`status`),
  ADD KEY `rma_complain_receives_rma_number_index` (`rma_number`),
  ADD KEY `rma_complain_receives_serial_id_index` (`serial_id`);

--
-- Indexes for table `rma_diagnoses`
--
ALTER TABLE `rma_diagnoses`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `rma_diagnoses_diagnosis_number_unique` (`diagnosis_number`),
  ADD KEY `rma_diagnoses_business_id_status_index` (`business_id`,`status`),
  ADD KEY `rma_diagnoses_complain_receive_id_index` (`complain_receive_id`);

--
-- Indexes for table `rma_engineer_fixings`
--
ALTER TABLE `rma_engineer_fixings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `rma_engineer_fixings_fixing_number_unique` (`fixing_number`),
  ADD KEY `rma_engineer_fixings_business_id_status_index` (`business_id`,`status`),
  ADD KEY `rma_engineer_fixings_complain_receive_id_index` (`complain_receive_id`);

--
-- Indexes for table `rma_item_utilizes`
--
ALTER TABLE `rma_item_utilizes`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `rma_item_utilizes_utilize_number_unique` (`utilize_number`),
  ADD KEY `rma_item_utilizes_business_id_status_index` (`business_id`,`status`),
  ADD KEY `rma_item_utilizes_complain_receive_id_index` (`complain_receive_id`);

--
-- Indexes for table `rma_problem_setups`
--
ALTER TABLE `rma_problem_setups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `rma_problem_setups_business_id_is_active_index` (`business_id`,`is_active`);

--
-- Indexes for table `rma_replacement_deliveries`
--
ALTER TABLE `rma_replacement_deliveries`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `rma_replacement_deliveries_delivery_number_unique` (`delivery_number`),
  ADD KEY `rma_replacement_deliveries_business_id_status_index` (`business_id`,`status`),
  ADD KEY `rma_replacement_deliveries_replace_in_id_index` (`replace_in_id`);

--
-- Indexes for table `rma_replace_ins`
--
ALTER TABLE `rma_replace_ins`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `rma_replace_ins_replace_in_number_unique` (`replace_in_number`),
  ADD KEY `rma_replace_ins_business_id_status_index` (`business_id`,`status`),
  ADD KEY `rma_replace_ins_replace_out_id_index` (`replace_out_id`);

--
-- Indexes for table `rma_replace_outs`
--
ALTER TABLE `rma_replace_outs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `rma_replace_outs_replace_out_number_unique` (`replace_out_number`),
  ADD KEY `rma_replace_outs_business_id_status_index` (`business_id`,`status`),
  ADD KEY `rma_replace_outs_complain_receive_id_index` (`complain_receive_id`);

--
-- Indexes for table `rma_serial_histories`
--
ALTER TABLE `rma_serial_histories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `rma_serial_histories_business_id_serial_id_index` (`business_id`,`serial_id`),
  ADD KEY `rma_serial_histories_serial_number_index` (`serial_number`),
  ADD KEY `rma_serial_histories_action_type_index` (`action_type`);

--
-- Indexes for table `rma_service_bills`
--
ALTER TABLE `rma_service_bills`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `rma_service_bills_service_bill_number_unique` (`service_bill_number`),
  ADD KEY `rma_service_bills_business_id_status_index` (`business_id`,`status`),
  ADD KEY `rma_service_bills_complain_receive_id_index` (`complain_receive_id`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `roles_business_id_foreign` (`business_id`);

--
-- Indexes for table `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`role_id`),
  ADD KEY `role_has_permissions_role_id_foreign` (`role_id`);

--
-- Indexes for table `selling_price_groups`
--
ALTER TABLE `selling_price_groups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `selling_price_groups_business_id_foreign` (`business_id`);

--
-- Indexes for table `sell_exchange`
--
ALTER TABLE `sell_exchange`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `sell_exchange_product`
--
ALTER TABLE `sell_exchange_product`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `serial_numbers`
--
ALTER TABLE `serial_numbers`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `service_warranties`
--
ALTER TABLE `service_warranties`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `sessions`
--
ALTER TABLE `sessions`
  ADD UNIQUE KEY `sessions_id_unique` (`id`);

--
-- Indexes for table `sheet_spreadsheets`
--
ALTER TABLE `sheet_spreadsheets`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sheet_spreadsheets_business_id_foreign` (`business_id`),
  ADD KEY `sheet_spreadsheets_created_by_index` (`created_by`);

--
-- Indexes for table `sheet_spreadsheet_shares`
--
ALTER TABLE `sheet_spreadsheet_shares`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sheet_spreadsheet_shares_sheet_spreadsheet_id_foreign` (`sheet_spreadsheet_id`),
  ADD KEY `sheet_spreadsheet_shares_shared_with_index` (`shared_with`),
  ADD KEY `sheet_spreadsheet_shares_shared_id_index` (`shared_id`);

--
-- Indexes for table `staff_awards`
--
ALTER TABLE `staff_awards`
  ADD PRIMARY KEY (`id`),
  ADD KEY `staff_awards_business_id_foreign` (`business_id`),
  ADD KEY `staff_awards_staff_id_foreign` (`staff_id`),
  ADD KEY `staff_awards_period_id_foreign` (`period_id`),
  ADD KEY `staff_awards_catalog_item_id_foreign` (`catalog_item_id`),
  ADD KEY `staff_awards_awarded_by_foreign` (`awarded_by`);

--
-- Indexes for table `staff_award_periods`
--
ALTER TABLE `staff_award_periods`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `staff_award_periods_business_id_period_type_period_start_unique` (`business_id`,`period_type`,`period_start`),
  ADD KEY `staff_award_periods_finalized_by_foreign` (`finalized_by`);

--
-- Indexes for table `staff_performance_activities`
--
ALTER TABLE `staff_performance_activities`
  ADD PRIMARY KEY (`id`),
  ADD KEY `staff_performance_activities_business_id_foreign` (`business_id`),
  ADD KEY `staff_performance_activities_staff_id_foreign` (`staff_id`),
  ADD KEY `staff_performance_activities_recorded_by_foreign` (`recorded_by`);

--
-- Indexes for table `staff_recognition_settings`
--
ALTER TABLE `staff_recognition_settings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `staff_recognition_settings_business_id_foreign` (`business_id`);

--
-- Indexes for table `stock_adjustment_lines`
--
ALTER TABLE `stock_adjustment_lines`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_adjustment_lines_product_id_foreign` (`product_id`),
  ADD KEY `stock_adjustment_lines_variation_id_foreign` (`variation_id`),
  ADD KEY `stock_adjustment_lines_transaction_id_index` (`transaction_id`),
  ADD KEY `stock_adjustment_lines_lot_no_line_id_index` (`lot_no_line_id`),
  ADD KEY `idx_sal_variation` (`variation_id`);

--
-- Indexes for table `subscriptions`
--
ALTER TABLE `subscriptions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `subscriptions_business_id_foreign` (`business_id`),
  ADD KEY `subscriptions_package_id_index` (`package_id`),
  ADD KEY `subscriptions_created_id_index` (`created_id`);

--
-- Indexes for table `superadmin_communicator_logs`
--
ALTER TABLE `superadmin_communicator_logs`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `superadmin_coupons`
--
ALTER TABLE `superadmin_coupons`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `superadmin_frontend_pages`
--
ALTER TABLE `superadmin_frontend_pages`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `tax_rates`
--
ALTER TABLE `tax_rates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `tax_rates_business_id_foreign` (`business_id`),
  ADD KEY `tax_rates_created_by_foreign` (`created_by`),
  ADD KEY `tax_rates_woocommerce_tax_rate_id_index` (`woocommerce_tax_rate_id`);

--
-- Indexes for table `tazas`
--
ALTER TABLE `tazas`
  ADD PRIMARY KEY (`id`),
  ADD KEY `tazas_business_id_foreign` (`business_id`),
  ADD KEY `tazas_currency_id_foreign` (`currency_id`);

--
-- Indexes for table `transaction_exchanges`
--
ALTER TABLE `transaction_exchanges`
  ADD PRIMARY KEY (`id`),
  ADD KEY `transaction_exchanges_location_id_foreign` (`location_id`),
  ADD KEY `transaction_exchanges_original_transaction_id_foreign` (`original_transaction_id`),
  ADD KEY `transaction_exchanges_exchange_transaction_id_foreign` (`exchange_transaction_id`),
  ADD KEY `transaction_exchanges_created_by_foreign` (`created_by`),
  ADD KEY `transaction_exchanges_business_id_status_index` (`business_id`,`status`),
  ADD KEY `transaction_exchanges_exchange_date_index` (`exchange_date`),
  ADD KEY `idx_exchange_amounts` (`original_amount`,`new_amount`,`exchange_difference`),
  ADD KEY `idx_exchange_financial` (`payment_received`,`refund_given`),
  ADD KEY `transaction_exchanges_cancelled_by_foreign` (`cancelled_by`);

--
-- Indexes for table `transaction_exchange_lines`
--
ALTER TABLE `transaction_exchange_lines`
  ADD PRIMARY KEY (`id`),
  ADD KEY `transaction_exchange_lines_exchange_id_foreign` (`exchange_id`),
  ADD KEY `transaction_exchange_lines_original_sell_line_id_foreign` (`original_sell_line_id`),
  ADD KEY `transaction_exchange_lines_new_sell_line_id_foreign` (`new_sell_line_id`);

--
-- Indexes for table `transaction_sell_lines`
--
ALTER TABLE `transaction_sell_lines`
  ADD PRIMARY KEY (`id`),
  ADD KEY `transaction_sell_lines_transaction_id_foreign` (`transaction_id`),
  ADD KEY `transaction_sell_lines_product_id_foreign` (`product_id`),
  ADD KEY `transaction_sell_lines_variation_id_foreign` (`variation_id`),
  ADD KEY `transaction_sell_lines_tax_id_foreign` (`tax_id`),
  ADD KEY `transaction_sell_lines_children_type_index` (`children_type`),
  ADD KEY `transaction_sell_lines_parent_sell_line_id_index` (`parent_sell_line_id`),
  ADD KEY `transaction_sell_lines_line_discount_type_index` (`line_discount_type`),
  ADD KEY `transaction_sell_lines_discount_id_index` (`discount_id`),
  ADD KEY `transaction_sell_lines_lot_no_line_id_index` (`lot_no_line_id`),
  ADD KEY `transaction_sell_lines_sub_unit_id_index` (`sub_unit_id`),
  ADD KEY `transaction_sell_lines_woocommerce_line_items_id_index` (`woocommerce_line_items_id`),
  ADD KEY `idx_tsl_variation` (`variation_id`),
  ADD KEY `idx_transaction_sell_lines_transaction` (`transaction_id`),
  ADD KEY `idx_transaction_sell_lines_variation` (`variation_id`),
  ADD KEY `idx_transaction_sell_lines_transaction_variation` (`transaction_id`,`variation_id`),
  ADD KEY `transaction_sell_lines_is_exchange_return_index` (`is_exchange_return`),
  ADD KEY `transaction_sell_lines_exchange_parent_line_id_index` (`exchange_parent_line_id`);

--
-- Indexes for table `transaction_sell_lines_purchase_lines`
--
ALTER TABLE `transaction_sell_lines_purchase_lines`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sell_line_id` (`sell_line_id`),
  ADD KEY `stock_adjustment_line_id` (`stock_adjustment_line_id`),
  ADD KEY `purchase_line_id` (`purchase_line_id`);

--
-- Indexes for table `types_of_services`
--
ALTER TABLE `types_of_services`
  ADD PRIMARY KEY (`id`),
  ADD KEY `types_of_services_business_id_index` (`business_id`);

--
-- Indexes for table `units`
--
ALTER TABLE `units`
  ADD PRIMARY KEY (`id`),
  ADD KEY `units_business_id_foreign` (`business_id`),
  ADD KEY `units_created_by_foreign` (`created_by`),
  ADD KEY `units_base_unit_id_index` (`base_unit_id`);

--
-- Indexes for table `user_contact_access`
--
ALTER TABLE `user_contact_access`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_contact_access_user_id_index` (`user_id`),
  ADD KEY `user_contact_access_contact_id_index` (`contact_id`);

--
-- Indexes for table `variations`
--
ALTER TABLE `variations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `variations_product_id_foreign` (`product_id`),
  ADD KEY `variations_product_variation_id_foreign` (`product_variation_id`),
  ADD KEY `variations_name_index` (`name`),
  ADD KEY `variations_sub_sku_index` (`sub_sku`),
  ADD KEY `variations_variation_value_id_index` (`variation_value_id`),
  ADD KEY `variations_woocommerce_variation_id_index` (`woocommerce_variation_id`);

--
-- Indexes for table `variation_group_prices`
--
ALTER TABLE `variation_group_prices`
  ADD PRIMARY KEY (`id`),
  ADD KEY `variation_group_prices_variation_id_foreign` (`variation_id`),
  ADD KEY `variation_group_prices_price_group_id_foreign` (`price_group_id`);

--
-- Indexes for table `variation_location_details`
--
ALTER TABLE `variation_location_details`
  ADD PRIMARY KEY (`id`),
  ADD KEY `variation_location_details_location_id_foreign` (`location_id`),
  ADD KEY `variation_location_details_product_id_index` (`product_id`),
  ADD KEY `variation_location_details_product_variation_id_index` (`product_variation_id`),
  ADD KEY `variation_location_details_variation_id_index` (`variation_id`),
  ADD KEY `idx_vld_vl` (`variation_id`,`location_id`),
  ADD KEY `idx_variation_location_details_location` (`location_id`),
  ADD KEY `idx_variation_location_details_variation_location` (`variation_id`,`location_id`),
  ADD KEY `idx_variation_location_details_location_variation` (`location_id`,`variation_id`);

--
-- Indexes for table `variation_templates`
--
ALTER TABLE `variation_templates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `variation_templates_business_id_foreign` (`business_id`),
  ADD KEY `variation_templates_woocommerce_attr_id_index` (`woocommerce_attr_id`);

--
-- Indexes for table `variation_value_templates`
--
ALTER TABLE `variation_value_templates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `variation_value_templates_name_index` (`name`),
  ADD KEY `variation_value_templates_variation_template_id_index` (`variation_template_id`);

--
-- Indexes for table `vld_backup_1_2026_03_15_18_50_01`
--
ALTER TABLE `vld_backup_1_2026_03_15_18_50_01`
  ADD PRIMARY KEY (`id`),
  ADD KEY `variation_location_details_location_id_foreign` (`location_id`),
  ADD KEY `variation_location_details_product_id_index` (`product_id`),
  ADD KEY `variation_location_details_product_variation_id_index` (`product_variation_id`),
  ADD KEY `variation_location_details_variation_id_index` (`variation_id`),
  ADD KEY `idx_vld_vl` (`variation_id`,`location_id`),
  ADD KEY `idx_variation_location_details_location` (`location_id`),
  ADD KEY `idx_variation_location_details_variation_location` (`variation_id`,`location_id`),
  ADD KEY `idx_variation_location_details_location_variation` (`location_id`,`variation_id`);

--
-- Indexes for table `vld_backup_1_2026_03_15_18_57_56`
--
ALTER TABLE `vld_backup_1_2026_03_15_18_57_56`
  ADD PRIMARY KEY (`id`),
  ADD KEY `variation_location_details_location_id_foreign` (`location_id`),
  ADD KEY `variation_location_details_product_id_index` (`product_id`),
  ADD KEY `variation_location_details_product_variation_id_index` (`product_variation_id`),
  ADD KEY `variation_location_details_variation_id_index` (`variation_id`),
  ADD KEY `idx_vld_vl` (`variation_id`,`location_id`),
  ADD KEY `idx_variation_location_details_location` (`location_id`),
  ADD KEY `idx_variation_location_details_variation_location` (`variation_id`,`location_id`),
  ADD KEY `idx_variation_location_details_location_variation` (`location_id`,`variation_id`);

--
-- Indexes for table `vld_backup_1_2026_03_15_19_30_41`
--
ALTER TABLE `vld_backup_1_2026_03_15_19_30_41`
  ADD PRIMARY KEY (`id`),
  ADD KEY `variation_location_details_location_id_foreign` (`location_id`),
  ADD KEY `variation_location_details_product_id_index` (`product_id`),
  ADD KEY `variation_location_details_product_variation_id_index` (`product_variation_id`),
  ADD KEY `variation_location_details_variation_id_index` (`variation_id`),
  ADD KEY `idx_vld_vl` (`variation_id`,`location_id`),
  ADD KEY `idx_variation_location_details_location` (`location_id`),
  ADD KEY `idx_variation_location_details_variation_location` (`variation_id`,`location_id`),
  ADD KEY `idx_variation_location_details_location_variation` (`location_id`,`variation_id`);

--
-- Indexes for table `warehouses`
--
ALTER TABLE `warehouses`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `warranties`
--
ALTER TABLE `warranties`
  ADD PRIMARY KEY (`id`),
  ADD KEY `warranties_business_id_index` (`business_id`),
  ADD KEY `warranties_duration_type_index` (`duration_type`);

--
-- Indexes for table `woocommerce_sync_logs`
--
ALTER TABLE `woocommerce_sync_logs`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `accounting_accounts`
--
ALTER TABLE `accounting_accounts`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2023;

--
-- AUTO_INCREMENT for table `accounting_accounts_transactions`
--
ALTER TABLE `accounting_accounts_transactions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=828;

--
-- AUTO_INCREMENT for table `accounting_account_types`
--
ALTER TABLE `accounting_account_types`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=181;

--
-- AUTO_INCREMENT for table `accounting_acc_trans_mappings`
--
ALTER TABLE `accounting_acc_trans_mappings`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=370;

--
-- AUTO_INCREMENT for table `accounting_budgets`
--
ALTER TABLE `accounting_budgets`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=185;

--
-- AUTO_INCREMENT for table `accounts`
--
ALTER TABLE `accounts`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=37;

--
-- AUTO_INCREMENT for table `account_transactions`
--
ALTER TABLE `account_transactions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1582;

--
-- AUTO_INCREMENT for table `account_types`
--
ALTER TABLE `account_types`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `activity_log`
--
ALTER TABLE `activity_log`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4123;

--
-- AUTO_INCREMENT for table `advanced_report_configurations`
--
ALTER TABLE `advanced_report_configurations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `advanced_report_exports`
--
ALTER TABLE `advanced_report_exports`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `advanced_report_saved_filters`
--
ALTER TABLE `advanced_report_saved_filters`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `advanced_report_schedules`
--
ALTER TABLE `advanced_report_schedules`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `aiassistance_history`
--
ALTER TABLE `aiassistance_history`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_audit_log`
--
ALTER TABLE `ar_audit_log`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_bank_accounts`
--
ALTER TABLE `ar_bank_accounts`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_bank_reconciliation`
--
ALTER TABLE `ar_bank_reconciliation`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_budgets`
--
ALTER TABLE `ar_budgets`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_capital_accounts`
--
ALTER TABLE `ar_capital_accounts`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_chart_of_accounts`
--
ALTER TABLE `ar_chart_of_accounts`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=66;

--
-- AUTO_INCREMENT for table `ar_cheque_books`
--
ALTER TABLE `ar_cheque_books`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_cheque_book_entries`
--
ALTER TABLE `ar_cheque_book_entries`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_direct_expenses`
--
ALTER TABLE `ar_direct_expenses`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_direct_expense_names`
--
ALTER TABLE `ar_direct_expense_names`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_direct_incomes`
--
ALTER TABLE `ar_direct_incomes`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_direct_income_names`
--
ALTER TABLE `ar_direct_income_names`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_fifo_layers`
--
ALTER TABLE `ar_fifo_layers`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_fixed_assets`
--
ALTER TABLE `ar_fixed_assets`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_fixed_asset_revaluations`
--
ALTER TABLE `ar_fixed_asset_revaluations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_investments`
--
ALTER TABLE `ar_investments`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_journal_entry_headers`
--
ALTER TABLE `ar_journal_entry_headers`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=261;

--
-- AUTO_INCREMENT for table `ar_journal_entry_lines`
--
ALTER TABLE `ar_journal_entry_lines`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=309;

--
-- AUTO_INCREMENT for table `ar_ledger_rollups`
--
ALTER TABLE `ar_ledger_rollups`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_loans`
--
ALTER TABLE `ar_loans`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_loan_transactions`
--
ALTER TABLE `ar_loan_transactions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_period_locks`
--
ALTER TABLE `ar_period_locks`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_ratio_snapshots`
--
ALTER TABLE `ar_ratio_snapshots`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ar_receivables_payables`
--
ALTER TABLE `ar_receivables_payables`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `assets`
--
ALTER TABLE `assets`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `asset_maintenances`
--
ALTER TABLE `asset_maintenances`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `asset_transactions`
--
ALTER TABLE `asset_transactions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `asset_warranties`
--
ALTER TABLE `asset_warranties`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `award_catalog`
--
ALTER TABLE `award_catalog`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `award_periods`
--
ALTER TABLE `award_periods`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `backup_logs`
--
ALTER TABLE `backup_logs`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `barcodes`
--
ALTER TABLE `barcodes`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `bookings`
--
ALTER TABLE `bookings`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `brands`
--
ALTER TABLE `brands`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=151;

--
-- AUTO_INCREMENT for table `business_backups`
--
ALTER TABLE `business_backups`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `business_locations`
--
ALTER TABLE `business_locations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;

--
-- AUTO_INCREMENT for table `business_management_audit_logs`
--
ALTER TABLE `business_management_audit_logs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;

--
-- AUTO_INCREMENT for table `cash_denominations`
--
ALTER TABLE `cash_denominations`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `cash_registers`
--
ALTER TABLE `cash_registers`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=72;

--
-- AUTO_INCREMENT for table `cash_register_transactions`
--
ALTER TABLE `cash_register_transactions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1704;

--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=415;

--
-- AUTO_INCREMENT for table `cms_pages`
--
ALTER TABLE `cms_pages`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `cms_page_metas`
--
ALTER TABLE `cms_page_metas`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `cms_site_details`
--
ALTER TABLE `cms_site_details`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `contacts`
--
ALTER TABLE `contacts`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=432;

--
-- AUTO_INCREMENT for table `crm_call_logs`
--
ALTER TABLE `crm_call_logs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `crm_campaigns`
--
ALTER TABLE `crm_campaigns`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `crm_contact_person_commissions`
--
ALTER TABLE `crm_contact_person_commissions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `crm_lead_users`
--
ALTER TABLE `crm_lead_users`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `crm_marketplaces`
--
ALTER TABLE `crm_marketplaces`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `crm_proposals`
--
ALTER TABLE `crm_proposals`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `crm_proposal_templates`
--
ALTER TABLE `crm_proposal_templates`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `crm_schedules`
--
ALTER TABLE `crm_schedules`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `crm_schedule_logs`
--
ALTER TABLE `crm_schedule_logs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `crm_schedule_users`
--
ALTER TABLE `crm_schedule_users`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `currencies`
--
ALTER TABLE `currencies`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=142;

--
-- AUTO_INCREMENT for table `customer_awards`
--
ALTER TABLE `customer_awards`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `customer_engagements`
--
ALTER TABLE `customer_engagements`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `customer_groups`
--
ALTER TABLE `customer_groups`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;

--
-- AUTO_INCREMENT for table `customer_recognition_cache`
--
ALTER TABLE `customer_recognition_cache`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `customer_recognition_settings`
--
ALTER TABLE `customer_recognition_settings`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `dashboard_configurations`
--
ALTER TABLE `dashboard_configurations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `discounts`
--
ALTER TABLE `discounts`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `document_and_notes`
--
ALTER TABLE `document_and_notes`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `essentials_allowances_and_deductions`
--
ALTER TABLE `essentials_allowances_and_deductions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `essentials_attendances`
--
ALTER TABLE `essentials_attendances`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `essentials_documents`
--
ALTER TABLE `essentials_documents`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `essentials_document_shares`
--
ALTER TABLE `essentials_document_shares`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `essentials_holidays`
--
ALTER TABLE `essentials_holidays`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `essentials_kb`
--
ALTER TABLE `essentials_kb`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `essentials_kb_users`
--
ALTER TABLE `essentials_kb_users`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `essentials_leaves`
--
ALTER TABLE `essentials_leaves`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `essentials_leave_types`
--
ALTER TABLE `essentials_leave_types`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `essentials_messages`
--
ALTER TABLE `essentials_messages`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `essentials_payroll_groups`
--
ALTER TABLE `essentials_payroll_groups`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `essentials_reminders`
--
ALTER TABLE `essentials_reminders`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `essentials_shifts`
--
ALTER TABLE `essentials_shifts`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `essentials_todo_comments`
--
ALTER TABLE `essentials_todo_comments`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `essentials_to_dos`
--
ALTER TABLE `essentials_to_dos`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `essentials_user_sales_targets`
--
ALTER TABLE `essentials_user_sales_targets`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `essentials_user_shifts`
--
ALTER TABLE `essentials_user_shifts`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `expense_categories`
--
ALTER TABLE `expense_categories`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=64;

--
-- AUTO_INCREMENT for table `field_forces`
--
ALTER TABLE `field_forces`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `installments`
--
ALTER TABLE `installments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;

--
-- AUTO_INCREMENT for table `installment_db`
--
ALTER TABLE `installment_db`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `installment_systems`
--
ALTER TABLE `installment_systems`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `inventory`
--
ALTER TABLE `inventory`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `inventory_products`
--
ALTER TABLE `inventory_products`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `invoice_layouts`
--
ALTER TABLE `invoice_layouts`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `invoice_schemes`
--
ALTER TABLE `invoice_schemes`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `media`
--
ALTER TABLE `media`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=283;

--
-- AUTO_INCREMENT for table `mfg_ingredient_groups`
--
ALTER TABLE `mfg_ingredient_groups`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mfg_recipes`
--
ALTER TABLE `mfg_recipes`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mfg_recipe_ingredients`
--
ALTER TABLE `mfg_recipe_ingredients`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=586;

--
-- AUTO_INCREMENT for table `module_licenses`
--
ALTER TABLE `module_licenses`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `notification_templates`
--
ALTER TABLE `notification_templates`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=161;

--
-- AUTO_INCREMENT for table `oauth_personal_access_clients`
--
ALTER TABLE `oauth_personal_access_clients`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `packages`
--
ALTER TABLE `packages`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=355;

--
-- AUTO_INCREMENT for table `pjt_invoice_lines`
--
ALTER TABLE `pjt_invoice_lines`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `pjt_projects`
--
ALTER TABLE `pjt_projects`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `pjt_project_members`
--
ALTER TABLE `pjt_project_members`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `pjt_project_tasks`
--
ALTER TABLE `pjt_project_tasks`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `pjt_project_task_comments`
--
ALTER TABLE `pjt_project_task_comments`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `pjt_project_task_members`
--
ALTER TABLE `pjt_project_task_members`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `pjt_project_time_logs`
--
ALTER TABLE `pjt_project_time_logs`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `premade_lines`
--
ALTER TABLE `premade_lines`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=39;

--
-- AUTO_INCREMENT for table `printers`
--
ALTER TABLE `printers`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2221;

--
-- AUTO_INCREMENT for table `product_racks`
--
ALTER TABLE `product_racks`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=234;

--
-- AUTO_INCREMENT for table `product_variations`
--
ALTER TABLE `product_variations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2221;

--
-- AUTO_INCREMENT for table `promotions`
--
ALTER TABLE `promotions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `promotion_audit_logs`
--
ALTER TABLE `promotion_audit_logs`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `promotion_daily_usage`
--
ALTER TABLE `promotion_daily_usage`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `promotion_templates`
--
ALTER TABLE `promotion_templates`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `purchase_lines`
--
ALTER TABLE `purchase_lines`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1726;

--
-- AUTO_INCREMENT for table `reference_counts`
--
ALTER TABLE `reference_counts`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=187;

--
-- AUTO_INCREMENT for table `repair_device_models`
--
ALTER TABLE `repair_device_models`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `repair_statuses`
--
ALTER TABLE `repair_statuses`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `res_tables`
--
ALTER TABLE `res_tables`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `return_groups`
--
ALTER TABLE `return_groups`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=177;

--
-- AUTO_INCREMENT for table `rma_complain_receives`
--
ALTER TABLE `rma_complain_receives`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `rma_diagnoses`
--
ALTER TABLE `rma_diagnoses`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `rma_engineer_fixings`
--
ALTER TABLE `rma_engineer_fixings`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `rma_item_utilizes`
--
ALTER TABLE `rma_item_utilizes`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `rma_problem_setups`
--
ALTER TABLE `rma_problem_setups`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `rma_replacement_deliveries`
--
ALTER TABLE `rma_replacement_deliveries`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `rma_replace_ins`
--
ALTER TABLE `rma_replace_ins`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `rma_replace_outs`
--
ALTER TABLE `rma_replace_outs`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `rma_serial_histories`
--
ALTER TABLE `rma_serial_histories`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `rma_service_bills`
--
ALTER TABLE `rma_service_bills`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;

--
-- AUTO_INCREMENT for table `selling_price_groups`
--
ALTER TABLE `selling_price_groups`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- AUTO_INCREMENT for table `sell_exchange`
--
ALTER TABLE `sell_exchange`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `sell_exchange_product`
--
ALTER TABLE `sell_exchange_product`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `serial_numbers`
--
ALTER TABLE `serial_numbers`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=629;

--
-- AUTO_INCREMENT for table `service_warranties`
--
ALTER TABLE `service_warranties`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `sheet_spreadsheets`
--
ALTER TABLE `sheet_spreadsheets`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `sheet_spreadsheet_shares`
--
ALTER TABLE `sheet_spreadsheet_shares`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `staff_awards`
--
ALTER TABLE `staff_awards`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `staff_award_periods`
--
ALTER TABLE `staff_award_periods`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `staff_performance_activities`
--
ALTER TABLE `staff_performance_activities`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `staff_recognition_settings`
--
ALTER TABLE `staff_recognition_settings`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `stock_adjustment_lines`
--
ALTER TABLE `stock_adjustment_lines`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `subscriptions`
--
ALTER TABLE `subscriptions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `superadmin_communicator_logs`
--
ALTER TABLE `superadmin_communicator_logs`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `superadmin_coupons`
--
ALTER TABLE `superadmin_coupons`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `superadmin_frontend_pages`
--
ALTER TABLE `superadmin_frontend_pages`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `tax_rates`
--
ALTER TABLE `tax_rates`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `tazas`
--
ALTER TABLE `tazas`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `transaction_exchanges`
--
ALTER TABLE `transaction_exchanges`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `transaction_exchange_lines`
--
ALTER TABLE `transaction_exchange_lines`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `transaction_sell_lines`
--
ALTER TABLE `transaction_sell_lines`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4028;

--
-- AUTO_INCREMENT for table `transaction_sell_lines_purchase_lines`
--
ALTER TABLE `transaction_sell_lines_purchase_lines`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3744;

--
-- AUTO_INCREMENT for table `types_of_services`
--
ALTER TABLE `types_of_services`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `units`
--
ALTER TABLE `units`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=93;

--
-- AUTO_INCREMENT for table `user_contact_access`
--
ALTER TABLE `user_contact_access`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `variations`
--
ALTER TABLE `variations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2226;

--
-- AUTO_INCREMENT for table `variation_group_prices`
--
ALTER TABLE `variation_group_prices`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=369;

--
-- AUTO_INCREMENT for table `variation_location_details`
--
ALTER TABLE `variation_location_details`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1547;

--
-- AUTO_INCREMENT for table `variation_templates`
--
ALTER TABLE `variation_templates`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `variation_value_templates`
--
ALTER TABLE `variation_value_templates`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33;

--
-- AUTO_INCREMENT for table `vld_backup_1_2026_03_15_18_50_01`
--
ALTER TABLE `vld_backup_1_2026_03_15_18_50_01`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1537;

--
-- AUTO_INCREMENT for table `vld_backup_1_2026_03_15_18_57_56`
--
ALTER TABLE `vld_backup_1_2026_03_15_18_57_56`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1537;

--
-- AUTO_INCREMENT for table `vld_backup_1_2026_03_15_19_30_41`
--
ALTER TABLE `vld_backup_1_2026_03_15_19_30_41`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1537;

--
-- AUTO_INCREMENT for table `warehouses`
--
ALTER TABLE `warehouses`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `warranties`
--
ALTER TABLE `warranties`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26;

--
-- AUTO_INCREMENT for table `woocommerce_sync_logs`
--
ALTER TABLE `woocommerce_sync_logs`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `advanced_report_exports`
--
ALTER TABLE `advanced_report_exports`
  ADD CONSTRAINT `advanced_report_exports_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `advanced_report_saved_filters`
--
ALTER TABLE `advanced_report_saved_filters`
  ADD CONSTRAINT `advanced_report_saved_filters_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `advanced_report_saved_filters_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `advanced_report_schedules`
--
ALTER TABLE `advanced_report_schedules`
  ADD CONSTRAINT `advanced_report_schedules_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `ar_audit_log`
--
ALTER TABLE `ar_audit_log`
  ADD CONSTRAINT `ar_audit_log_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_audit_log_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `ar_bank_accounts`
--
ALTER TABLE `ar_bank_accounts`
  ADD CONSTRAINT `ar_bank_accounts_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_bank_accounts_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_bank_accounts_linked_account_id_foreign` FOREIGN KEY (`linked_account_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_bank_accounts_opening_balance_transaction_id_foreign` FOREIGN KEY (`opening_balance_transaction_id`) REFERENCES `account_transactions` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `ar_bank_reconciliation`
--
ALTER TABLE `ar_bank_reconciliation`
  ADD CONSTRAINT `ar_bank_reconciliation_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `ar_chart_of_accounts` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_bank_reconciliation_account_transaction_id_foreign` FOREIGN KEY (`account_transaction_id`) REFERENCES `account_transactions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_bank_reconciliation_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_bank_reconciliation_cleared_by_foreign` FOREIGN KEY (`cleared_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `ar_capital_accounts`
--
ALTER TABLE `ar_capital_accounts`
  ADD CONSTRAINT `ar_capital_accounts_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_capital_accounts_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `ar_chart_of_accounts`
--
ALTER TABLE `ar_chart_of_accounts`
  ADD CONSTRAINT `ar_chart_of_accounts_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_chart_of_accounts_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_chart_of_accounts_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_chart_of_accounts_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `ar_chart_of_accounts` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_chart_of_accounts_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `ar_cheque_books`
--
ALTER TABLE `ar_cheque_books`
  ADD CONSTRAINT `ar_cheque_books_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_cheque_books_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_cheque_books_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_cheque_books_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `business_locations` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `ar_cheque_book_entries`
--
ALTER TABLE `ar_cheque_book_entries`
  ADD CONSTRAINT `ar_cheque_book_entries_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_cheque_book_entries_account_transaction_id_foreign` FOREIGN KEY (`account_transaction_id`) REFERENCES `account_transactions` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_cheque_book_entries_bank_account_id_foreign` FOREIGN KEY (`bank_account_id`) REFERENCES `ar_bank_accounts` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_cheque_book_entries_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_cheque_book_entries_cheque_book_id_foreign` FOREIGN KEY (`cheque_book_id`) REFERENCES `ar_cheque_books` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_cheque_book_entries_contact_id_foreign` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_cheque_book_entries_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_cheque_book_entries_deposit_account_id_foreign` FOREIGN KEY (`deposit_account_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_cheque_book_entries_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `business_locations` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_cheque_book_entries_source_cheque_id_foreign` FOREIGN KEY (`source_cheque_id`) REFERENCES `ar_cheque_book_entries` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_cheque_book_entries_transaction_id_foreign` FOREIGN KEY (`transaction_id`) REFERENCES `transactions` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_cheque_book_entries_transaction_payment_id_foreign` FOREIGN KEY (`transaction_payment_id`) REFERENCES `transaction_payments` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `ar_direct_expenses`
--
ALTER TABLE `ar_direct_expenses`
  ADD CONSTRAINT `ar_direct_expenses_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_direct_expenses_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_direct_expenses_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_direct_expenses_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `business_locations` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_direct_expenses_payment_account_id_foreign` FOREIGN KEY (`payment_account_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `ar_direct_expense_names`
--
ALTER TABLE `ar_direct_expense_names`
  ADD CONSTRAINT `ar_direct_expense_names_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_direct_expense_names_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `ar_direct_incomes`
--
ALTER TABLE `ar_direct_incomes`
  ADD CONSTRAINT `ar_direct_incomes_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_direct_incomes_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_direct_incomes_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_direct_incomes_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `business_locations` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_direct_incomes_payment_account_id_foreign` FOREIGN KEY (`payment_account_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `ar_direct_income_names`
--
ALTER TABLE `ar_direct_income_names`
  ADD CONSTRAINT `ar_direct_income_names_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_direct_income_names_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `ar_fifo_layers`
--
ALTER TABLE `ar_fifo_layers`
  ADD CONSTRAINT `ar_fifo_layers_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_fifo_layers_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `business_locations` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_fifo_layers_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_fifo_layers_transaction_id_foreign` FOREIGN KEY (`transaction_id`) REFERENCES `transactions` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_fifo_layers_variation_id_foreign` FOREIGN KEY (`variation_id`) REFERENCES `variations` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `ar_fixed_assets`
--
ALTER TABLE `ar_fixed_assets`
  ADD CONSTRAINT `ar_fixed_assets_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_fixed_assets_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `ar_fixed_asset_revaluations`
--
ALTER TABLE `ar_fixed_asset_revaluations`
  ADD CONSTRAINT `ar_fixed_asset_revaluations_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_fixed_asset_revaluations_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_fixed_asset_revaluations_fixed_asset_id_foreign` FOREIGN KEY (`fixed_asset_id`) REFERENCES `ar_fixed_assets` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `ar_investments`
--
ALTER TABLE `ar_investments`
  ADD CONSTRAINT `ar_investments_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_investments_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `ar_journal_entry_headers`
--
ALTER TABLE `ar_journal_entry_headers`
  ADD CONSTRAINT `ar_journal_entry_headers_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_journal_entry_headers_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_journal_entry_headers_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `business_locations` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_journal_entry_headers_posted_by_foreign` FOREIGN KEY (`posted_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_journal_entry_headers_source_transaction_id_foreign` FOREIGN KEY (`source_transaction_id`) REFERENCES `transactions` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `ar_journal_entry_lines`
--
ALTER TABLE `ar_journal_entry_lines`
  ADD CONSTRAINT `ar_journal_entry_lines_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `ar_chart_of_accounts` (`id`),
  ADD CONSTRAINT `ar_journal_entry_lines_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_journal_entry_lines_contact_id_foreign` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_journal_entry_lines_journal_entry_id_foreign` FOREIGN KEY (`journal_entry_id`) REFERENCES `ar_journal_entry_headers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_journal_entry_lines_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_journal_entry_lines_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `tax_rates` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_journal_entry_lines_variation_id_foreign` FOREIGN KEY (`variation_id`) REFERENCES `variations` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `ar_ledger_rollups`
--
ALTER TABLE `ar_ledger_rollups`
  ADD CONSTRAINT `ar_ledger_rollups_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `ar_chart_of_accounts` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_ledger_rollups_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_ledger_rollups_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `business_locations` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `ar_loans`
--
ALTER TABLE `ar_loans`
  ADD CONSTRAINT `ar_loans_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_loans_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_loans_liability_account_id_foreign` FOREIGN KEY (`liability_account_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_loans_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `business_locations` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_loans_payment_account_id_foreign` FOREIGN KEY (`payment_account_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `ar_loan_transactions`
--
ALTER TABLE `ar_loan_transactions`
  ADD CONSTRAINT `ar_loan_transactions_account_transaction_id_foreign` FOREIGN KEY (`account_transaction_id`) REFERENCES `account_transactions` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_loan_transactions_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_loan_transactions_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_loan_transactions_loan_id_foreign` FOREIGN KEY (`loan_id`) REFERENCES `ar_loans` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_loan_transactions_payment_account_id_foreign` FOREIGN KEY (`payment_account_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `ar_period_locks`
--
ALTER TABLE `ar_period_locks`
  ADD CONSTRAINT `ar_period_locks_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_period_locks_locked_by_foreign` FOREIGN KEY (`locked_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_period_locks_unlocked_by_foreign` FOREIGN KEY (`unlocked_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `ar_ratio_snapshots`
--
ALTER TABLE `ar_ratio_snapshots`
  ADD CONSTRAINT `ar_ratio_snapshots_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `ar_receivables_payables`
--
ALTER TABLE `ar_receivables_payables`
  ADD CONSTRAINT `ar_receivables_payables_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_receivables_payables_contact_id_foreign` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `ar_receivables_payables_journal_entry_id_foreign` FOREIGN KEY (`journal_entry_id`) REFERENCES `ar_journal_entry_headers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ar_receivables_payables_transaction_id_foreign` FOREIGN KEY (`transaction_id`) REFERENCES `transactions` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `assets`
--
ALTER TABLE `assets`
  ADD CONSTRAINT `assets_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `assets_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`),
  ADD CONSTRAINT `assets_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`);

--
-- Constraints for table `asset_transactions`
--
ALTER TABLE `asset_transactions`
  ADD CONSTRAINT `asset_transactions_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `asset_transactions_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `asset_transactions_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `asset_transactions_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `asset_transactions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `asset_transactions_receiver_foreign` FOREIGN KEY (`receiver`) REFERENCES `users` (`id`);

--
-- Constraints for table `award_catalog`
--
ALTER TABLE `award_catalog`
  ADD CONSTRAINT `award_catalog_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `award_catalog_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `award_periods`
--
ALTER TABLE `award_periods`
  ADD CONSTRAINT `award_periods_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `award_periods_finalized_by_foreign` FOREIGN KEY (`finalized_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `backup_logs`
--
ALTER TABLE `backup_logs`
  ADD CONSTRAINT `backup_logs_backup_id_foreign` FOREIGN KEY (`backup_id`) REFERENCES `business_backups` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `backup_logs_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `backup_logs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `barcodes`
--
ALTER TABLE `barcodes`
  ADD CONSTRAINT `barcodes_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `bookings`
--
ALTER TABLE `bookings`
  ADD CONSTRAINT `bookings_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `bookings_contact_id_foreign` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `bookings_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `brands`
--
ALTER TABLE `brands`
  ADD CONSTRAINT `brands_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `brands_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `business_backups`
--
ALTER TABLE `business_backups`
  ADD CONSTRAINT `business_backups_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `business_backups_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `business_locations`
--
ALTER TABLE `business_locations`
  ADD CONSTRAINT `business_locations_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `business_locations_invoice_layout_id_foreign` FOREIGN KEY (`invoice_layout_id`) REFERENCES `invoice_layouts` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `business_locations_invoice_scheme_id_foreign` FOREIGN KEY (`invoice_scheme_id`) REFERENCES `invoice_schemes` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `cash_registers`
--
ALTER TABLE `cash_registers`
  ADD CONSTRAINT `cash_registers_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `cash_registers_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `cash_register_transactions`
--
ALTER TABLE `cash_register_transactions`
  ADD CONSTRAINT `cash_register_transactions_cash_register_id_foreign` FOREIGN KEY (`cash_register_id`) REFERENCES `cash_registers` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `categories`
--
ALTER TABLE `categories`
  ADD CONSTRAINT `categories_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `categories_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `cms_page_metas`
--
ALTER TABLE `cms_page_metas`
  ADD CONSTRAINT `cms_page_metas_cms_page_id_foreign` FOREIGN KEY (`cms_page_id`) REFERENCES `cms_pages` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `contacts`
--
ALTER TABLE `contacts`
  ADD CONSTRAINT `contacts_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `contacts_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `crm_campaigns`
--
ALTER TABLE `crm_campaigns`
  ADD CONSTRAINT `crm_campaigns_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `crm_lead_users`
--
ALTER TABLE `crm_lead_users`
  ADD CONSTRAINT `crm_lead_users_contact_id_foreign` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `crm_proposals`
--
ALTER TABLE `crm_proposals`
  ADD CONSTRAINT `crm_proposals_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `crm_proposals_contact_id_foreign` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `crm_proposal_templates`
--
ALTER TABLE `crm_proposal_templates`
  ADD CONSTRAINT `crm_proposal_templates_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `crm_schedules`
--
ALTER TABLE `crm_schedules`
  ADD CONSTRAINT `crm_schedules_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `crm_schedule_logs`
--
ALTER TABLE `crm_schedule_logs`
  ADD CONSTRAINT `crm_schedule_logs_schedule_id_foreign` FOREIGN KEY (`schedule_id`) REFERENCES `crm_schedules` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `crm_schedule_users`
--
ALTER TABLE `crm_schedule_users`
  ADD CONSTRAINT `crm_schedule_users_schedule_id_foreign` FOREIGN KEY (`schedule_id`) REFERENCES `crm_schedules` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `customer_awards`
--
ALTER TABLE `customer_awards`
  ADD CONSTRAINT `customer_awards_awarded_by_foreign` FOREIGN KEY (`awarded_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `customer_awards_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `customer_awards_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `customer_awards_period_id_foreign` FOREIGN KEY (`period_id`) REFERENCES `award_periods` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `customer_engagements`
--
ALTER TABLE `customer_engagements`
  ADD CONSTRAINT `customer_engagements_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `customer_engagements_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `customer_engagements_recorded_by_foreign` FOREIGN KEY (`recorded_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `customer_groups`
--
ALTER TABLE `customer_groups`
  ADD CONSTRAINT `customer_groups_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `customer_recognition_cache`
--
ALTER TABLE `customer_recognition_cache`
  ADD CONSTRAINT `customer_recognition_cache_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `customer_recognition_cache_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `customer_recognition_settings`
--
ALTER TABLE `customer_recognition_settings`
  ADD CONSTRAINT `customer_recognition_settings_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `dashboard_configurations`
--
ALTER TABLE `dashboard_configurations`
  ADD CONSTRAINT `dashboard_configurations_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `essentials_kb`
--
ALTER TABLE `essentials_kb`
  ADD CONSTRAINT `essentials_kb_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `essentials_kb` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `essentials_payroll_group_transactions`
--
ALTER TABLE `essentials_payroll_group_transactions`
  ADD CONSTRAINT `essentials_payroll_group_transactions_payroll_group_id_foreign` FOREIGN KEY (`payroll_group_id`) REFERENCES `essentials_payroll_groups` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `expense_categories`
--
ALTER TABLE `expense_categories`
  ADD CONSTRAINT `expense_categories_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `group_sub_taxes`
--
ALTER TABLE `group_sub_taxes`
  ADD CONSTRAINT `group_sub_taxes_group_tax_id_foreign` FOREIGN KEY (`group_tax_id`) REFERENCES `tax_rates` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `group_sub_taxes_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `tax_rates` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `inventory`
--
ALTER TABLE `inventory`
  ADD CONSTRAINT `inventory_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `business_locations` (`id`);

--
-- Constraints for table `inventory_products`
--
ALTER TABLE `inventory_products`
  ADD CONSTRAINT `inventory_products_inventory_id_foreign` FOREIGN KEY (`inventory_id`) REFERENCES `inventory` (`id`),
  ADD CONSTRAINT `inventory_products_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `inventory_products_transaction_id_foreign` FOREIGN KEY (`transaction_id`) REFERENCES `transactions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `inventory_products_variation_id_foreign` FOREIGN KEY (`variation_id`) REFERENCES `variations` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `invoice_layouts`
--
ALTER TABLE `invoice_layouts`
  ADD CONSTRAINT `invoice_layouts_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `invoice_schemes`
--
ALTER TABLE `invoice_schemes`
  ADD CONSTRAINT `invoice_schemes_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `mfg_recipe_ingredients`
--
ALTER TABLE `mfg_recipe_ingredients`
  ADD CONSTRAINT `mfg_recipe_ingredients_mfg_recipe_id_foreign` FOREIGN KEY (`mfg_recipe_id`) REFERENCES `mfg_recipes` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `pjt_invoice_lines`
--
ALTER TABLE `pjt_invoice_lines`
  ADD CONSTRAINT `pjt_invoice_lines_transaction_id_foreign` FOREIGN KEY (`transaction_id`) REFERENCES `transactions` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `pjt_project_members`
--
ALTER TABLE `pjt_project_members`
  ADD CONSTRAINT `pjt_project_members_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `pjt_projects` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `pjt_project_tasks`
--
ALTER TABLE `pjt_project_tasks`
  ADD CONSTRAINT `pjt_project_tasks_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `pjt_projects` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `pjt_project_task_comments`
--
ALTER TABLE `pjt_project_task_comments`
  ADD CONSTRAINT `pjt_project_task_comments_project_task_id_foreign` FOREIGN KEY (`project_task_id`) REFERENCES `pjt_project_tasks` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `pjt_project_task_members`
--
ALTER TABLE `pjt_project_task_members`
  ADD CONSTRAINT `pjt_project_task_members_project_task_id_foreign` FOREIGN KEY (`project_task_id`) REFERENCES `pjt_project_tasks` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `pjt_project_time_logs`
--
ALTER TABLE `pjt_project_time_logs`
  ADD CONSTRAINT `pjt_project_time_logs_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `pjt_projects` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `pjt_project_time_logs_project_task_id_foreign` FOREIGN KEY (`project_task_id`) REFERENCES `pjt_project_tasks` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `premade_lines`
--
ALTER TABLE `premade_lines`
  ADD CONSTRAINT `premade_lines_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `premade_lines_premade_product_id_foreign` FOREIGN KEY (`premade_product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `premade_lines_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `premade_lines_variation_id_foreign` FOREIGN KEY (`variation_id`) REFERENCES `variations` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `printers`
--
ALTER TABLE `printers`
  ADD CONSTRAINT `printers_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `products`
--
ALTER TABLE `products`
  ADD CONSTRAINT `products_brand_id_foreign` FOREIGN KEY (`brand_id`) REFERENCES `brands` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `products_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `products_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `products_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `products_repair_model_id_foreign` FOREIGN KEY (`repair_model_id`) REFERENCES `repair_device_models` (`id`),
  ADD CONSTRAINT `products_sub_category_id_foreign` FOREIGN KEY (`sub_category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `products_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `contacts` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `products_tax_foreign` FOREIGN KEY (`tax`) REFERENCES `tax_rates` (`id`),
  ADD CONSTRAINT `products_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `product_variations`
--
ALTER TABLE `product_variations`
  ADD CONSTRAINT `product_variations_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `promotions`
--
ALTER TABLE `promotions`
  ADD CONSTRAINT `promotions_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `promotions_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `promotions_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `business_locations` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `promotions_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `promotion_audit_logs`
--
ALTER TABLE `promotion_audit_logs`
  ADD CONSTRAINT `promotion_audit_logs_promotion_id_foreign` FOREIGN KEY (`promotion_id`) REFERENCES `promotions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `promotion_audit_logs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `promotion_daily_usage`
--
ALTER TABLE `promotion_daily_usage`
  ADD CONSTRAINT `promotion_daily_usage_promotion_id_foreign` FOREIGN KEY (`promotion_id`) REFERENCES `promotions` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `promotion_templates`
--
ALTER TABLE `promotion_templates`
  ADD CONSTRAINT `promotion_templates_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `promotion_templates_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `purchase_lines`
--
ALTER TABLE `purchase_lines`
  ADD CONSTRAINT `purchase_lines_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `purchase_lines_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `tax_rates` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `purchase_lines_transaction_id_foreign` FOREIGN KEY (`transaction_id`) REFERENCES `transactions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `purchase_lines_variation_id_foreign` FOREIGN KEY (`variation_id`) REFERENCES `variations` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `repair_device_models`
--
ALTER TABLE `repair_device_models`
  ADD CONSTRAINT `repair_device_models_brand_id_foreign` FOREIGN KEY (`brand_id`) REFERENCES `brands` (`id`),
  ADD CONSTRAINT `repair_device_models_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `repair_device_models_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `repair_device_models_device_id_foreign` FOREIGN KEY (`device_id`) REFERENCES `categories` (`id`);

--
-- Constraints for table `res_product_modifier_sets`
--
ALTER TABLE `res_product_modifier_sets`
  ADD CONSTRAINT `res_product_modifier_sets_modifier_set_id_foreign` FOREIGN KEY (`modifier_set_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `res_tables`
--
ALTER TABLE `res_tables`
  ADD CONSTRAINT `res_tables_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `roles`
--
ALTER TABLE `roles`
  ADD CONSTRAINT `roles_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `selling_price_groups`
--
ALTER TABLE `selling_price_groups`
  ADD CONSTRAINT `selling_price_groups_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `sheet_spreadsheets`
--
ALTER TABLE `sheet_spreadsheets`
  ADD CONSTRAINT `sheet_spreadsheets_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `sheet_spreadsheet_shares`
--
ALTER TABLE `sheet_spreadsheet_shares`
  ADD CONSTRAINT `sheet_spreadsheet_shares_sheet_spreadsheet_id_foreign` FOREIGN KEY (`sheet_spreadsheet_id`) REFERENCES `sheet_spreadsheets` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `staff_awards`
--
ALTER TABLE `staff_awards`
  ADD CONSTRAINT `staff_awards_awarded_by_foreign` FOREIGN KEY (`awarded_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `staff_awards_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `staff_awards_catalog_item_id_foreign` FOREIGN KEY (`catalog_item_id`) REFERENCES `variations` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `staff_awards_period_id_foreign` FOREIGN KEY (`period_id`) REFERENCES `staff_award_periods` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `staff_awards_staff_id_foreign` FOREIGN KEY (`staff_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `staff_award_periods`
--
ALTER TABLE `staff_award_periods`
  ADD CONSTRAINT `staff_award_periods_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `staff_award_periods_finalized_by_foreign` FOREIGN KEY (`finalized_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `staff_performance_activities`
--
ALTER TABLE `staff_performance_activities`
  ADD CONSTRAINT `staff_performance_activities_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `staff_performance_activities_recorded_by_foreign` FOREIGN KEY (`recorded_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `staff_performance_activities_staff_id_foreign` FOREIGN KEY (`staff_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `staff_recognition_settings`
--
ALTER TABLE `staff_recognition_settings`
  ADD CONSTRAINT `staff_recognition_settings_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `stock_adjustment_lines`
--
ALTER TABLE `stock_adjustment_lines`
  ADD CONSTRAINT `stock_adjustment_lines_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `stock_adjustment_lines_transaction_id_foreign` FOREIGN KEY (`transaction_id`) REFERENCES `transactions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `stock_adjustment_lines_variation_id_foreign` FOREIGN KEY (`variation_id`) REFERENCES `variations` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `subscriptions`
--
ALTER TABLE `subscriptions`
  ADD CONSTRAINT `subscriptions_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `tax_rates`
--
ALTER TABLE `tax_rates`
  ADD CONSTRAINT `tax_rates_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `tax_rates_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `tazas`
--
ALTER TABLE `tazas`
  ADD CONSTRAINT `tazas_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `tazas_currency_id_foreign` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `transaction_exchanges`
--
ALTER TABLE `transaction_exchanges`
  ADD CONSTRAINT `transaction_exchanges_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `transaction_exchanges_cancelled_by_foreign` FOREIGN KEY (`cancelled_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `transaction_exchanges_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `transaction_exchanges_exchange_transaction_id_foreign` FOREIGN KEY (`exchange_transaction_id`) REFERENCES `transactions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `transaction_exchanges_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `business_locations` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `transaction_exchanges_original_transaction_id_foreign` FOREIGN KEY (`original_transaction_id`) REFERENCES `transactions` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `transaction_exchange_lines`
--
ALTER TABLE `transaction_exchange_lines`
  ADD CONSTRAINT `transaction_exchange_lines_exchange_id_foreign` FOREIGN KEY (`exchange_id`) REFERENCES `transaction_exchanges` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `transaction_exchange_lines_new_sell_line_id_foreign` FOREIGN KEY (`new_sell_line_id`) REFERENCES `transaction_sell_lines` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `transaction_exchange_lines_original_sell_line_id_foreign` FOREIGN KEY (`original_sell_line_id`) REFERENCES `transaction_sell_lines` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `transaction_sell_lines`
--
ALTER TABLE `transaction_sell_lines`
  ADD CONSTRAINT `transaction_sell_lines_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `transaction_sell_lines_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `tax_rates` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `transaction_sell_lines_transaction_id_foreign` FOREIGN KEY (`transaction_id`) REFERENCES `transactions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `transaction_sell_lines_variation_id_foreign` FOREIGN KEY (`variation_id`) REFERENCES `variations` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `units`
--
ALTER TABLE `units`
  ADD CONSTRAINT `units_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `units_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `variations`
--
ALTER TABLE `variations`
  ADD CONSTRAINT `variations_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `variations_product_variation_id_foreign` FOREIGN KEY (`product_variation_id`) REFERENCES `product_variations` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `variation_group_prices`
--
ALTER TABLE `variation_group_prices`
  ADD CONSTRAINT `variation_group_prices_price_group_id_foreign` FOREIGN KEY (`price_group_id`) REFERENCES `selling_price_groups` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `variation_group_prices_variation_id_foreign` FOREIGN KEY (`variation_id`) REFERENCES `variations` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `variation_location_details`
--
ALTER TABLE `variation_location_details`
  ADD CONSTRAINT `variation_location_details_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `business_locations` (`id`),
  ADD CONSTRAINT `variation_location_details_variation_id_foreign` FOREIGN KEY (`variation_id`) REFERENCES `variations` (`id`);

--
-- Constraints for table `variation_templates`
--
ALTER TABLE `variation_templates`
  ADD CONSTRAINT `variation_templates_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `business` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `variation_value_templates`
--
ALTER TABLE `variation_value_templates`
  ADD CONSTRAINT `variation_value_templates_variation_template_id_foreign` FOREIGN KEY (`variation_template_id`) REFERENCES `variation_templates` (`id`) ON DELETE CASCADE;
COMMIT;

