--
-- Indexes for table `accounts_groups`
--
ALTER TABLE `accounts_groups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `accounts_groups_head_id_foreign` (`head_id`);

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

--
-- Indexes for table `accounts_ledgers`
--
ALTER TABLE `accounts_ledgers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `accounts_ledgers_group_id_foreign` (`group_id`);

--
-- Indexes for table `activitycenters`
--
ALTER TABLE `activitycenters`
  ADD PRIMARY KEY (`id`),
  ADD KEY `activitycenters_division_id_foreign` (`division_id`),
  ADD KEY `activitycenters_uom_id_foreign` (`uom_id`),
  ADD KEY `activitycenters_cost_stage_id_foreign` (`cost_stage_id`);

--
-- Indexes for table `activity_types`
--
ALTER TABLE `activity_types`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `activity_types_activity_type_unique` (`activity_type`),
  ADD KEY `activity_types_division_id_foreign` (`division_id`);

--
-- Indexes for table `additiondeductionentries`
--
ALTER TABLE `additiondeductionentries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `additiondeductionentries_division_id_foreign` (`division_id`),
  ADD KEY `additiondeductionentries_employee_id_foreign` (`employee_id`),
  ADD KEY `additiondeductionentries_additiondeduction_id_foreign` (`additiondeduction_id`),
  ADD KEY `additiondeductionentries_canteen_id_foreign` (`canteen_id`),
  ADD KEY `additiondeductionentries_daily_driver_update_id_foreign` (`daily_driver_update_id`);

--
-- Indexes for table `addition_deductions`
--
ALTER TABLE `addition_deductions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `addition_deductions_name_unique` (`name`),
  ADD KEY `addition_deductions_ledger_id_foreign` (`ledger_id`);

--
-- Indexes for table `advance_entries`
--
ALTER TABLE `advance_entries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `advance_entries_emp_id_foreign` (`emp_id`),
  ADD KEY `advance_entries_division_id_foreign` (`division_id`),
  ADD KEY `advance_entries_purchase_advance_id_foreign` (`purchase_advance_id`),
  ADD KEY `advance_entries_paid_ledger_id_foreign` (`paid_ledger_id`),
  ADD KEY `advance_entries_paid_group_company_id_foreign` (`paid_group_company_id`);

--
-- Indexes for table `advance_receives`
--
ALTER TABLE `advance_receives`
  ADD PRIMARY KEY (`id`),
  ADD KEY `advance_receives_advance_id_foreign` (`advance_id`),
  ADD KEY `advance_receives_emp_id_foreign` (`emp_id`),
  ADD KEY `advance_receives_division_id_foreign` (`division_id`),
  ADD KEY `advance_receives_receive_ledger_id_foreign` (`receive_ledger_id`),
  ADD KEY `advance_receives_receive_group_company_id_foreign` (`receive_group_company_id`);

--
-- Indexes for table `assets`
--
ALTER TABLE `assets`
  ADD PRIMARY KEY (`id`),
  ADD KEY `assets_asset_group_id_foreign` (`asset_group_id`),
  ADD KEY `assets_division_id_foreign` (`division_id`),
  ADD KEY `assets_vendor_id_foreign` (`vendor_id`),
  ADD KEY `assets_group_company_id_foreign` (`group_company_id`),
  ADD KEY `assets_ledger_id_foreign` (`ledger_id`);

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

--
-- Indexes for table `asset_cost_centers`
--
ALTER TABLE `asset_cost_centers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `asset_cost_centers_division_id_foreign` (`division_id`),
  ADD KEY `asset_cost_centers_asset_id_foreign` (`asset_id`),
  ADD KEY `asset_cost_centers_ledger_id_foreign` (`ledger_id`);

--
-- Indexes for table `asset_groups`
--
ALTER TABLE `asset_groups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `asset_groups_category_id_foreign` (`category_id`);

--
-- Indexes for table `bankings`
--
ALTER TABLE `bankings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `bankings_division_id_foreign` (`division_id`),
  ADD KEY `bankings_ledger_id_foreign` (`ledger_id`),
  ADD KEY `bankings_group_id_foreign` (`group_id`);

--
-- Indexes for table `banking_od_subs`
--
ALTER TABLE `banking_od_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `banking_od_subs_main_id_foreign` (`main_id`),
  ADD KEY `banking_od_subs_division_id_foreign` (`division_id`);

--
-- Indexes for table `bank_deposits`
--
ALTER TABLE `bank_deposits`
  ADD PRIMARY KEY (`id`),
  ADD KEY `bank_deposits_division_id_foreign` (`division_id`),
  ADD KEY `bank_deposits_main_ledger_id_foreign` (`main_ledger_id`),
  ADD KEY `bank_deposits_group_company_id_foreign` (`group_company_id`);

--
-- Indexes for table `bank_deposit_subs`
--
ALTER TABLE `bank_deposit_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `bank_deposit_subs_bank_deposit_id_foreign` (`bank_deposit_id`),
  ADD KEY `bank_deposit_subs_ledger_id_foreign` (`ledger_id`);

--
-- Indexes for table `bank_transfers`
--
ALTER TABLE `bank_transfers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `bank_transfers_from_ledger_id_foreign` (`from_ledger_id`),
  ADD KEY `bank_transfers_to_ledger_id_foreign` (`to_ledger_id`),
  ADD KEY `bank_transfers_from_group_company_id_foreign` (`from_group_company_id`),
  ADD KEY `bank_transfers_to_group_company_id_foreign` (`to_group_company_id`),
  ADD KEY `bank_transfers_from_division_id_foreign` (`from_division_id`),
  ADD KEY `bank_transfers_to_division_id_foreign` (`to_division_id`);

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

--
-- Indexes for table `branch_creations`
--
ALTER TABLE `branch_creations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `branch_creations_headstaff_id_foreign` (`headstaff_id`);

--
-- Indexes for table `canteenlogs`
--
ALTER TABLE `canteenlogs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `canteenlogs_division_id_foreign` (`division_id`),
  ADD KEY `canteenlogs_contractor_id_foreign` (`contractor_id`);

--
-- Indexes for table `canteenlogsubs`
--
ALTER TABLE `canteenlogsubs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `canteenlogsubs_main_id_foreign` (`main_id`),
  ADD KEY `canteenlogsubs_employee_id_foreign` (`employee_id`),
  ADD KEY `canteenlogsubs_contractor_id_foreign` (`contractor_id`);

--
-- Indexes for table `canteenmealrates`
--
ALTER TABLE `canteenmealrates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `canteenmealrates_supplier_id_foreign` (`supplier_id`);

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

--
-- Indexes for table `collectionforms`
--
ALTER TABLE `collectionforms`
  ADD PRIMARY KEY (`id`),
  ADD KEY `collectionforms_customer_id_foreign` (`customer_id`),
  ADD KEY `collectionforms_executive_id_foreign` (`executive_id`),
  ADD KEY `collectionforms_excess_amount_division_foreign` (`excess_amount_division`),
  ADD KEY `collectionforms_branch_id_foreign` (`branch_id`),
  ADD KEY `collectionforms_excessamount_groupcompany_id_foreign` (`excessamount_groupcompany_id`),
  ADD KEY `collectionforms_bank_ledger_id_foreign` (`bank_ledger_id`),
  ADD KEY `collectionforms_round_off_division_foreign` (`round_off_division`);

--
-- Indexes for table `collectionform_subs`
--
ALTER TABLE `collectionform_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `collectionform_subs_main_id_foreign` (`main_id`),
  ADD KEY `collectionform_subs_division_id_foreign` (`division_id`);

--
-- Indexes for table `collection_followups`
--
ALTER TABLE `collection_followups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `collection_followups_customer_id_foreign` (`customer_id`),
  ADD KEY `collection_followups_executive_id_foreign` (`executive_id`),
  ADD KEY `collection_followups_branch_id_foreign` (`branch_id`);

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

--
-- Indexes for table `collection_followup_histories`
--
ALTER TABLE `collection_followup_histories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `collection_followup_histories_followup_id_foreign` (`followup_id`),
  ADD KEY `collection_followup_histories_history_id_foreign` (`history_id`),
  ADD KEY `collection_followup_histories_follow_comment_id_foreign` (`follow_comment_id`);

--
-- Indexes for table `collection_projections`
--
ALTER TABLE `collection_projections`
  ADD PRIMARY KEY (`id`),
  ADD KEY `collection_projections_executive_id_foreign` (`executive_id`);

--
-- Indexes for table `collection_projection_subs`
--
ALTER TABLE `collection_projection_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `collection_projection_subs_main_id_foreign` (`main_id`),
  ADD KEY `collection_projection_subs_customer_id_foreign` (`customer_id`);

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

--
-- Indexes for table `company_addresses`
--
ALTER TABLE `company_addresses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `company_addresses_group_company_id_foreign` (`group_company_id`);

--
-- Indexes for table `contract_logs`
--
ALTER TABLE `contract_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `contract_logs_division_id_foreign` (`division_id`),
  ADD KEY `contract_logs_salary_type_foreign` (`salary_type`);

--
-- Indexes for table `contract_log_subs`
--
ALTER TABLE `contract_log_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `contract_log_subs_log_id_foreign` (`log_id`),
  ADD KEY `contract_log_subs_emp_id_foreign` (`emp_id`),
  ADD KEY `contract_log_subs_division_id_foreign` (`division_id`),
  ADD KEY `contract_log_subs_salary_type_foreign` (`salary_type`),
  ADD KEY `contract_log_subs_product_cost_id_foreign` (`product_cost_id`),
  ADD KEY `contract_log_subs_product_id_foreign` (`product_id`);

--
-- Indexes for table `contract_prouct_costs`
--
ALTER TABLE `contract_prouct_costs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `contract_prouct_costs_division_id_foreign` (`division_id`),
  ADD KEY `contract_prouct_costs_product_id_foreign` (`product_id`),
  ADD KEY `contract_prouct_costs_uom_id_foreign` (`uom_id`);

--
-- Indexes for table `costing_stages`
--
ALTER TABLE `costing_stages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `costing_stages_division_id_foreign` (`division_id`);

--
-- Indexes for table `cost_centers`
--
ALTER TABLE `cost_centers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cost_centers_division_id_foreign` (`division_id`),
  ADD KEY `cost_centers_cost_center_id_foreign` (`cost_center_id`);

--
-- Indexes for table `creditnotes`
--
ALTER TABLE `creditnotes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `creditnotes_salesreturn_id_foreign` (`salesreturn_id`),
  ADD KEY `creditnotes_customer_id_foreign` (`customer_id`),
  ADD KEY `creditnotes_salesperson_id_foreign` (`salesperson_id`),
  ADD KEY `creditnotes_branch_id_foreign` (`branch_id`),
  ADD KEY `creditnotes_division_id_foreign` (`division_id`),
  ADD KEY `creditnotes_discount_id_foreign` (`discount_id`),
  ADD KEY `creditnotes_salesorder_id_foreign` (`salesorder_id`),
  ADD KEY `creditnotes_group_company_id_foreign` (`group_company_id`);

--
-- Indexes for table `creditnotesubs`
--
ALTER TABLE `creditnotesubs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `creditnotesubs_main_id_foreign` (`main_id`),
  ADD KEY `creditnotesubs_sales_return_subid_foreign` (`sales_return_subid`),
  ADD KEY `creditnotesubs_product_id_foreign` (`product_id`),
  ADD KEY `creditnotesubs_tax_id_foreign` (`tax_id`),
  ADD KEY `creditnotesubs_salesorder_subid_foreign` (`salesorder_subid`);

--
-- Indexes for table `customeraddresses`
--
ALTER TABLE `customeraddresses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customeraddresses_customer_id_foreign` (`customer_id`);

--
-- Indexes for table `customeropeningbalances`
--
ALTER TABLE `customeropeningbalances`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customeropeningbalances_customer_id_foreign` (`customer_id`),
  ADD KEY `customeropeningbalances_division_id_foreign` (`division_id`),
  ADD KEY `customeropeningbalances_salesperson_id_foreign` (`salesperson_id`),
  ADD KEY `customeropeningbalances_branch_id_foreign` (`branch_id`);

--
-- Indexes for table `customerpos`
--
ALTER TABLE `customerpos`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customerpos_customer_id_foreign` (`customer_id`),
  ADD KEY `customerpos_division_id_foreign` (`division_id`);

--
-- Indexes for table `customerposubs`
--
ALTER TABLE `customerposubs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customerposubs_main_id_foreign` (`main_id`),
  ADD KEY `customerposubs_product_id_foreign` (`product_id`),
  ADD KEY `customerposubs_tax_id_foreign` (`tax_id`);

--
-- Indexes for table `customerresponsibilities`
--
ALTER TABLE `customerresponsibilities`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customerresponsibilities_employee_id_foreign` (`employee_id`);

--
-- Indexes for table `customers`
--
ALTER TABLE `customers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `customers_customer_code_unique` (`customer_code`),
  ADD KEY `customers_branch_id_foreign` (`branch_id`),
  ADD KEY `customers_payterms_id_foreign` (`payterms_id`),
  ADD KEY `customers_emp_responsibility_id_foreign` (`emp_responsibility_id`);

--
-- Indexes for table `customer_bills`
--
ALTER TABLE `customer_bills`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customer_bills_customer_id_foreign` (`customer_id`),
  ADD KEY `customer_bills_division_id_foreign` (`division_id`),
  ADD KEY `customer_bills_salesperson_id_foreign` (`salesperson_id`),
  ADD KEY `customer_bills_branch_id_foreign` (`branch_id`),
  ADD KEY `customer_bills_groupcompany_id_foreign` (`groupcompany_id`),
  ADD KEY `entry_date` (`entry_date`),
  ADD KEY `refer` (`refer`),
  ADD KEY `bill_id` (`bill_id`),
  ADD KEY `pay_id` (`pay_id`);

--
-- Indexes for table `customer_transactions`
--
ALTER TABLE `customer_transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customer_transactions_customer_id_foreign` (`customer_id`),
  ADD KEY `customer_transactions_division_id_foreign` (`division_id`),
  ADD KEY `customer_transactions_salesperson_id_foreign` (`salesperson_id`),
  ADD KEY `customer_transactions_branch_id_foreign` (`branch_id`),
  ADD KEY `customer_transactions_groupcompany_id_foreign` (`groupcompany_id`),
  ADD KEY `entry_date` (`entry_date`);

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

--
-- Indexes for table `designation_wages_subs`
--
ALTER TABLE `designation_wages_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `designation_wages_subs_employee_id_foreign` (`employee_id`),
  ADD KEY `designation_wages_subs_designation_id_foreign` (`designation_id`);

--
-- Indexes for table `dieselissues`
--
ALTER TABLE `dieselissues`
  ADD PRIMARY KEY (`id`),
  ADD KEY `dieselissues_division_id_foreign` (`division_id`),
  ADD KEY `dieselissues_warehouse_id_foreign` (`warehouse_id`);

--
-- Indexes for table `dieselissues_subs`
--
ALTER TABLE `dieselissues_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `dieselissues_subs_main_id_foreign` (`main_id`),
  ADD KEY `dieselissues_subs_asset_id_foreign` (`asset_id`),
  ADD KEY `dieselissues_subs_workorder_id_foreign` (`workorder_id`);

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

--
-- Indexes for table `divisions`
--
ALTER TABLE `divisions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `divisions_ledger_id_foreign` (`ledger_id`);

--
-- Indexes for table `division_dispatch_costs`
--
ALTER TABLE `division_dispatch_costs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `division_dispatch_costs_dispatch_vehicles_id_foreign` (`dispatch_vehicles_id`);

--
-- Indexes for table `division_dispatch_vehicles`
--
ALTER TABLE `division_dispatch_vehicles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `division_dispatch_vehicles_division_id_foreign` (`division_id`),
  ADD KEY `division_dispatch_vehicles_asset_group_id_foreign` (`asset_group_id`);

--
-- Indexes for table `driver_daily_updates`
--
ALTER TABLE `driver_daily_updates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `driver_daily_updates_division_id_foreign` (`division_id`),
  ADD KEY `driver_daily_updates_shift_id_foreign` (`shift_id`);

--
-- Indexes for table `driver_daily_updates_subs`
--
ALTER TABLE `driver_daily_updates_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `driver_daily_updates_subs_main_log_id_foreign` (`main_log_id`),
  ADD KEY `driver_daily_updates_subs_emp_id_foreign` (`emp_id`),
  ADD KEY `driver_daily_updates_subs_division_id_foreign` (`division_id`),
  ADD KEY `driver_daily_updates_subs_salary_type_foreign` (`salary_type`),
  ADD KEY `driver_daily_updates_subs_shift_id_foreign` (`shift_id`);

--
-- Indexes for table `eb_meter_masters`
--
ALTER TABLE `eb_meter_masters`
  ADD PRIMARY KEY (`id`),
  ADD KEY `eb_meter_masters_division_id_foreign` (`division_id`);

--
-- Indexes for table `employees`
--
ALTER TABLE `employees`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employees_division_id_foreign` (`division_id`),
  ADD KEY `employees_designation_id_foreign` (`designation_id`),
  ADD KEY `employees_salary_type_foreign` (`salary_type`),
  ADD KEY `employees_group_company_id_foreign` (`group_company_id`);

--
-- Indexes for table `employee_biometrics`
--
ALTER TABLE `employee_biometrics`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_biometrics_empcode_foreign` (`Empcode`),
  ADD KEY `logdate` (`logdate`);

--
-- Indexes for table `employee_documents`
--
ALTER TABLE `employee_documents`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_documents_employee_id_foreign` (`employee_id`);

--
-- Indexes for table `employee_earnings`
--
ALTER TABLE `employee_earnings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_earnings_emp_id_foreign` (`emp_id`),
  ADD KEY `employee_earnings_division_id_foreign` (`division_id`),
  ADD KEY `employee_earnings_salary_type_foreign` (`salary_type`),
  ADD KEY `employee_earnings_main_division_id_foreign` (`main_division_id`);

--
-- Indexes for table `employee_education_subs`
--
ALTER TABLE `employee_education_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_education_subs_employee_id_foreign` (`employee_id`);

--
-- Indexes for table `employee_experience_subs`
--
ALTER TABLE `employee_experience_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_experience_subs_employee_id_foreign` (`employee_id`);

--
-- Indexes for table `employee_salaries`
--
ALTER TABLE `employee_salaries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_salaries_emp_id_foreign` (`emp_id`);

--
-- Indexes for table `employee_staff_salaries`
--
ALTER TABLE `employee_staff_salaries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_staff_salaries_emp_id_foreign` (`emp_id`);

--
-- Indexes for table `employee_transactions`
--
ALTER TABLE `employee_transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_transactions_emp_id_foreign` (`emp_id`),
  ADD KEY `employee_transactions_division_id_foreign` (`division_id`);

--
-- Indexes for table `estimationforms`
--
ALTER TABLE `estimationforms`
  ADD PRIMARY KEY (`id`),
  ADD KEY `estimationforms_customer_id_foreign` (`customer_id`),
  ADD KEY `estimationforms_deliverysite_id_foreign` (`deliverysite_id`),
  ADD KEY `estimationforms_branch_id_foreign` (`branch_id`),
  ADD KEY `estimationforms_division_id_foreign` (`division_id`),
  ADD KEY `estimationforms_salesperson_id_foreign` (`salesperson_id`),
  ADD KEY `estimationforms_paymentterm_id_foreign` (`paymentterm_id`),
  ADD KEY `estimationforms_po_id_foreign` (`po_id`),
  ADD KEY `estimationforms_unloading_type_id_foreign` (`unloading_type_id`),
  ADD KEY `estimationforms_salesorder_id_foreign` (`salesorder_id`),
  ADD KEY `estimationforms_project_id_foreign` (`project_id`);

--
-- Indexes for table `estimationformsubs`
--
ALTER TABLE `estimationformsubs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `estimationformsubs_main_id_foreign` (`main_id`),
  ADD KEY `estimationformsubs_product_id_foreign` (`product_id`),
  ADD KEY `estimationformsubs_uom_id_foreign` (`uom_id`),
  ADD KEY `estimationformsubs_tax_id_foreign` (`tax_id`);

--
-- Indexes for table `expense_types`
--
ALTER TABLE `expense_types`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `expense_types_name_unique` (`name`),
  ADD KEY `expense_types_ledger_id_foreign` (`ledger_id`);

--
-- Indexes for table `expense_vouchers`
--
ALTER TABLE `expense_vouchers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `expense_vouchers_instructed_by_foreign` (`instructed_by`),
  ADD KEY `expense_vouchers_issued_by_foreign` (`issued_by`),
  ADD KEY `expense_vouchers_division_id_foreign` (`division_id`),
  ADD KEY `expense_vouchers_asset_id_foreign` (`asset_id`),
  ADD KEY `expense_vouchers_group_company_foreign` (`group_company`),
  ADD KEY `expense_vouchers_paid_id_foreign` (`paid_id`);

--
-- Indexes for table `expense_voucher_subs`
--
ALTER TABLE `expense_voucher_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `expense_voucher_subs_expense_voucher_id_foreign` (`expense_voucher_id`),
  ADD KEY `expense_voucher_subs_expense_type_foreign` (`expense_type`);

--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Indexes for table `fund_transfers`
--
ALTER TABLE `fund_transfers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fund_transfers_receive_division_foreign` (`receive_division`),
  ADD KEY `fund_transfers_transfer_division_foreign` (`transfer_division`),
  ADD KEY `fund_transfers_cash_bank_ledger_id_foreign` (`cash_bank_ledger_id`),
  ADD KEY `fund_transfers_group_company_id_foreign` (`group_company_id`);

--
-- Indexes for table `gate_entries`
--
ALTER TABLE `gate_entries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `gate_entries_purchaseorder_id_foreign` (`purchaseorder_id`),
  ADD KEY `gate_entries_manual_trip_id_foreign` (`manual_trip_id`),
  ADD KEY `gate_entries_trip_id_foreign` (`trip_id`),
  ADD KEY `gate_entries_driver_id_foreign` (`driver_id`);

--
-- Indexes for table `gate_passes`
--
ALTER TABLE `gate_passes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `gate_passes_division_id_foreign` (`division_id`),
  ADD KEY `gate_passes_request_by_foreign` (`request_by`),
  ADD KEY `gate_passes_vehicle_id_foreign` (`vehicle_id`);

--
-- Indexes for table `gate_pass_ins`
--
ALTER TABLE `gate_pass_ins`
  ADD PRIMARY KEY (`id`),
  ADD KEY `gate_pass_ins_received_by_foreign` (`received_by`),
  ADD KEY `gate_pass_ins_gate_pass_id_foreign` (`gate_pass_id`);

--
-- Indexes for table `gate_pass_in_subs`
--
ALTER TABLE `gate_pass_in_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `gate_pass_in_subs_gate_in_id_foreign` (`gate_in_id`),
  ADD KEY `gate_pass_in_subs_gate_pass_id_foreign` (`gate_pass_id`),
  ADD KEY `gate_pass_in_subs_gate_pass_sub_id_foreign` (`gate_pass_sub_id`);

--
-- Indexes for table `gate_pass_subs`
--
ALTER TABLE `gate_pass_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `gate_pass_subs_gate_pass_id_foreign` (`gate_pass_id`),
  ADD KEY `gate_pass_subs_uom_id_foreign` (`uom_id`);

--
-- Indexes for table `grns`
--
ALTER TABLE `grns`
  ADD PRIMARY KEY (`id`),
  ADD KEY `grns_division_id_foreign` (`division_id`),
  ADD KEY `grns_order_id_foreign` (`order_id`),
  ADD KEY `grns_gate_id_foreign` (`gate_id`),
  ADD KEY `grns_manual_trip_id_foreign` (`manual_trip_id`);

--
-- Indexes for table `grn_bills`
--
ALTER TABLE `grn_bills`
  ADD PRIMARY KEY (`id`),
  ADD KEY `grn_bills_order_id_foreign` (`order_id`),
  ADD KEY `grn_bills_grn_id_foreign` (`grn_id`),
  ADD KEY `grn_bills_supplier_id_foreign` (`supplier_id`),
  ADD KEY `grn_bills_delivery_id_foreign` (`delivery_id`),
  ADD KEY `grn_bills_billing_address_id_foreign` (`billing_address_id`),
  ADD KEY `grn_bills_other_id_foreign` (`other_id`),
  ADD KEY `grn_bills_group_company_id_foreign` (`group_company_id`),
  ADD KEY `grn_bills_tds_ledger_foreign` (`tds_ledger`),
  ADD KEY `grn_bills_tds_id_foreign` (`tds_id`);

--
-- Indexes for table `grn_bill_subs`
--
ALTER TABLE `grn_bill_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `grn_bill_subs_grn_bill_id_foreign` (`grn_bill_id`),
  ADD KEY `grn_bill_subs_order_id_foreign` (`order_id`),
  ADD KEY `grn_bill_subs_order_sub_id_foreign` (`order_sub_id`),
  ADD KEY `grn_bill_subs_grn_id_foreign` (`grn_id`),
  ADD KEY `grn_bill_subs_grn_sub_id_foreign` (`grn_sub_id`),
  ADD KEY `grn_bill_subs_product_id_foreign` (`product_id`),
  ADD KEY `grn_bill_subs_asset_ledger_id_foreign` (`asset_ledger_id`),
  ADD KEY `grn_bill_subs_hsn_id_foreign` (`hsn_id`);

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

--
-- Indexes for table `grn_subs`
--
ALTER TABLE `grn_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `grn_subs_grn_id_foreign` (`grn_id`),
  ADD KEY `grn_subs_order_id_foreign` (`order_id`),
  ADD KEY `grn_subs_order_sub_id_foreign` (`order_sub_id`),
  ADD KEY `grn_subs_reject_reason_id_foreign` (`reject_reason_id`),
  ADD KEY `grn_subs_brand_name_foreign` (`brand_name`),
  ADD KEY `grn_subs_warehouse_id_foreign` (`warehouse_id`);

--
-- Indexes for table `groupcompanies`
--
ALTER TABLE `groupcompanies`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `groupcompanies_pan_no_unique` (`pan_no`),
  ADD KEY `groupcompanies_company_id_foreign` (`company_id`);

--
-- Indexes for table `hsns`
--
ALTER TABLE `hsns`
  ADD PRIMARY KEY (`id`),
  ADD KEY `hsns_tax_id_foreign` (`tax_id`);

--
-- Indexes for table `intercompanyfreights`
--
ALTER TABLE `intercompanyfreights`
  ADD PRIMARY KEY (`id`),
  ADD KEY `intercompanyfreights_sales_division_id_foreign` (`sales_division_id`),
  ADD KEY `intercompanyfreights_purchase_division_id_foreign` (`purchase_division_id`),
  ADD KEY `intercompanyfreights_asset_group_id_foreign` (`asset_group_id`),
  ADD KEY `intercompanyfreights_uom_id_foreign` (`uom_id`);

--
-- Indexes for table `intercompanyfreighttrackings`
--
ALTER TABLE `intercompanyfreighttrackings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `intercompanyfreighttrackings_intercompanyfreight_id_foreign` (`intercompanyfreight_id`);

--
-- Indexes for table `inter_company_inwards`
--
ALTER TABLE `inter_company_inwards`
  ADD PRIMARY KEY (`id`),
  ADD KEY `inter_company_inwards_purchase_id_foreign` (`purchase_id`),
  ADD KEY `inter_company_inwards_sales_id_foreign` (`sales_id`),
  ADD KEY `inter_company_inwards_trip_id_foreign` (`trip_id`),
  ADD KEY `inter_company_inwards_purchase_from_foreign` (`purchase_from`),
  ADD KEY `inter_company_inwards_deliver_to_foreign` (`deliver_to`),
  ADD KEY `inter_company_inwards_purchase_product_id_foreign` (`purchase_product_id`),
  ADD KEY `inter_company_inwards_sale_product_id_foreign` (`sale_product_id`),
  ADD KEY `inter_company_inwards_purchase_group_company_id_foreign` (`purchase_group_company_id`),
  ADD KEY `inter_company_inwards_deliver_group_company_id_foreign` (`deliver_group_company_id`),
  ADD KEY `inter_company_inwards_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `inter_company_inwards_warehouse_id_from_foreign` (`warehouse_id_from`);

--
-- Indexes for table `inter_company_loadings`
--
ALTER TABLE `inter_company_loadings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `inter_company_loadings_trip_id_foreign` (`trip_id`),
  ADD KEY `inter_company_loadings_purchase_from_foreign` (`purchase_from`),
  ADD KEY `inter_company_loadings_deliver_to_foreign` (`deliver_to`),
  ADD KEY `inter_company_loadings_asset_id_foreign` (`asset_id`);

--
-- Indexes for table `inter_company_weighments`
--
ALTER TABLE `inter_company_weighments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `inter_company_weighments_trip_id_foreign` (`trip_id`);

--
-- Indexes for table `inter_purchase_requests`
--
ALTER TABLE `inter_purchase_requests`
  ADD PRIMARY KEY (`id`),
  ADD KEY `inter_purchase_requests_purchase_from_foreign` (`purchase_from`),
  ADD KEY `inter_purchase_requests_deliver_to_foreign` (`deliver_to`),
  ADD KEY `inter_purchase_requests_product_id_foreign` (`product_id`),
  ADD KEY `inter_purchase_requests_purchase_req_id_foreign` (`purchase_req_id`);

--
-- Indexes for table `inter_sales_orders`
--
ALTER TABLE `inter_sales_orders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `inter_sales_orders_request_id_foreign` (`request_id`),
  ADD KEY `inter_sales_orders_deliver_to_foreign` (`deliver_to`),
  ADD KEY `inter_sales_orders_product_id_foreign` (`product_id`),
  ADD KEY `inter_sales_orders_purchase_from_foreign` (`purchase_from`);

--
-- Indexes for table `inter_sales_trackings`
--
ALTER TABLE `inter_sales_trackings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `inter_sales_trackings_trip_id_foreign` (`trip_id`);

--
-- Indexes for table `inter_sales_trips`
--
ALTER TABLE `inter_sales_trips`
  ADD PRIMARY KEY (`id`),
  ADD KEY `inter_sales_trips_sales_id_foreign` (`sales_id`),
  ADD KEY `inter_sales_trips_trip_id_foreign` (`trip_id`),
  ADD KEY `inter_sales_trips_assign_truck_id_foreign` (`assign_truck_id`),
  ADD KEY `inter_sales_trips_shift_id_foreign` (`shift_id`),
  ADD KEY `inter_sales_trips_product_id_foreign` (`product_id`),
  ADD KEY `inter_sales_trips_purchase_from_foreign` (`purchase_from`),
  ADD KEY `inter_sales_trips_deliver_to_foreign` (`deliver_to`),
  ADD KEY `inter_sales_trips_purchase_group_company_id_foreign` (`purchase_group_company_id`),
  ADD KEY `inter_sales_trips_deliver_group_company_id_foreign` (`deliver_group_company_id`),
  ADD KEY `inter_sales_trips_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `inter_sales_trips_warehouse_id_to_foreign` (`warehouse_id_to`);

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

--
-- Indexes for table `inwardcheques`
--
ALTER TABLE `inwardcheques`
  ADD PRIMARY KEY (`id`),
  ADD KEY `inwardcheques_collection_id_foreign` (`collection_id`),
  ADD KEY `inwardcheques_depositebank_id_foreign` (`depositebank_id`),
  ADD KEY `inwardcheques_return_reason_foreign` (`return_reason`),
  ADD KEY `inwardcheques_bank_ledger_id_foreign` (`bank_ledger_id`);

--
-- Indexes for table `job_cards`
--
ALTER TABLE `job_cards`
  ADD PRIMARY KEY (`id`),
  ADD KEY `job_cards_division_id_foreign` (`division_id`),
  ADD KEY `job_cards_asset_id_foreign` (`asset_id`),
  ADD KEY `job_cards_work_reason_id_foreign` (`work_reason_id`);

--
-- Indexes for table `job_card_daily_actions`
--
ALTER TABLE `job_card_daily_actions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `job_card_daily_actions_job_id_foreign` (`job_id`);

--
-- Indexes for table `journal_vouchers`
--
ALTER TABLE `journal_vouchers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `journal_vouchers_division_id_foreign` (`division_id`),
  ADD KEY `journal_vouchers_group_company_id_foreign` (`group_company_id`);

--
-- Indexes for table `journal_voucher_subs`
--
ALTER TABLE `journal_voucher_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `journal_voucher_subs_journal_voucher_id_foreign` (`journal_voucher_id`),
  ADD KEY `journal_voucher_subs_ledger_id_foreign` (`ledger_id`),
  ADD KEY `journal_voucher_subs_emp_id_foreign` (`emp_id`),
  ADD KEY `journal_voucher_subs_asset_id_foreign` (`asset_id`),
  ADD KEY `journal_voucher_subs_supplier_id_foreign` (`supplier_id`);

--
-- Indexes for table `kmhraudits`
--
ALTER TABLE `kmhraudits`
  ADD PRIMARY KEY (`id`),
  ADD KEY `kmhraudits_audited_by_foreign` (`audited_by`);

--
-- Indexes for table `kmhraudit_subs`
--
ALTER TABLE `kmhraudit_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `kmhraudit_subs_main_id_foreign` (`main_id`),
  ADD KEY `kmhraudit_subs_asset_id_foreign` (`asset_id`);

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

--
-- Indexes for table `leave_entries`
--
ALTER TABLE `leave_entries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `leave_entries_emp_id_foreign` (`emp_id`),
  ADD KEY `leave_entries_division_id_foreign` (`division_id`),
  ADD KEY `leave_entries_leave_type_foreign` (`leave_type`),
  ADD KEY `leave_entries_shift_id_foreign` (`shift_id`);

--
-- Indexes for table `ledger_transactions`
--
ALTER TABLE `ledger_transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ledger_transactions_division_id_foreign` (`division_id`),
  ADD KEY `ledger_transactions_ledger_id_foreign` (`ledger_id`),
  ADD KEY `ledger_transactions_group_company_id_foreign` (`group_company_id`),
  ADD KEY `entry_date` (`entry_date`);

--
-- Indexes for table `loading_types`
--
ALTER TABLE `loading_types`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `loading_types_loading_type_unique` (`loading_type`),
  ADD KEY `loading_types_division_id_foreign` (`division_id`),
  ADD KEY `loading_types_uom_id_foreign` (`uom_id`),
  ADD KEY `loading_types_asset_group_foreign` (`asset_group`);

--
-- Indexes for table `loading_type_costs`
--
ALTER TABLE `loading_type_costs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `loading_type_costs_loading_type_id_foreign` (`loading_type_id`),
  ADD KEY `loading_type_costs_uom_id_foreign` (`uom_id`);

--
-- Indexes for table `machineryassigns`
--
ALTER TABLE `machineryassigns`
  ADD PRIMARY KEY (`id`),
  ADD KEY `machineryassigns_shift_id_foreign` (`shift_id`),
  ADD KEY `machineryassigns_machinery_id_foreign` (`machinery_id`),
  ADD KEY `machineryassigns_driver_id_foreign` (`driver_id`),
  ADD KEY `machineryassigns_job_card_id_foreign` (`job_card_id`),
  ADD KEY `machineryassigns_parked_site_id_foreign` (`parked_site_id`);

--
-- Indexes for table `machinery_logs`
--
ALTER TABLE `machinery_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `machinery_logs_machinery_id_foreign` (`machinery_id`),
  ADD KEY `machinery_logs_operator_id_foreign` (`operator_id`),
  ADD KEY `machinery_logs_shift_id_foreign` (`shift_id`);

--
-- Indexes for table `machinery_log_subs`
--
ALTER TABLE `machinery_log_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `machinery_log_subs_machinery_log_id_foreign` (`machinery_log_id`),
  ADD KEY `machinery_log_subs_division_id_foreign` (`division_id`),
  ADD KEY `machinery_log_subs_activity_type_foreign` (`activity_type`);

--
-- Indexes for table `machine_activity_logs`
--
ALTER TABLE `machine_activity_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `machine_activity_logs_division_id_foreign` (`division_id`),
  ADD KEY `machine_activity_logs_activity_type_foreign` (`activity_type`),
  ADD KEY `machine_activity_logs_asset_id_foreign` (`asset_id`),
  ADD KEY `machine_activity_logs_customer_id_foreign` (`customer_id`),
  ADD KEY `machine_activity_logs_delivery_site_id_foreign` (`delivery_site_id`);

--
-- Indexes for table `machine_activity_log_dcs`
--
ALTER TABLE `machine_activity_log_dcs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `machine_activity_log_dcs_log_main_id_foreign` (`log_main_id`),
  ADD KEY `machine_activity_log_dcs_sales_dc_id_foreign` (`sales_dc_id`);

--
-- Indexes for table `machine_centers`
--
ALTER TABLE `machine_centers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `machine_centers_division_id_foreign` (`division_id`),
  ADD KEY `machine_centers_work_center_id_foreign` (`work_center_id`);

--
-- Indexes for table `machine_center_costs`
--
ALTER TABLE `machine_center_costs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `machine_center_costs_machine_center_id_foreign` (`machine_center_id`),
  ADD KEY `machine_center_costs_cost_type_id_foreign` (`cost_type_id`);

--
-- Indexes for table `manual_attendances`
--
ALTER TABLE `manual_attendances`
  ADD PRIMARY KEY (`id`),
  ADD KEY `manual_attendances_division_id_foreign` (`division_id`),
  ADD KEY `manual_attendances_salary_type_foreign` (`salary_type`),
  ADD KEY `manual_attendances_shift_id_foreign` (`shift_id`);

--
-- Indexes for table `manual_attendance_subs`
--
ALTER TABLE `manual_attendance_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `manual_attendance_subs_attendance_id_foreign` (`attendance_id`),
  ADD KEY `manual_attendance_subs_emp_id_foreign` (`emp_id`),
  ADD KEY `manual_attendance_subs_main_division_id_foreign` (`main_division_id`),
  ADD KEY `manual_attendance_subs_salary_type_foreign` (`salary_type`),
  ADD KEY `manual_attendance_subs_shift_id_foreign` (`shift_id`),
  ADD KEY `manual_attendance_subs_sub_division_id_foreign` (`sub_division_id`),
  ADD KEY `manual_attendance_subs_design_wages_id_foreign` (`design_wages_id`);

--
-- Indexes for table `manual_trip_sheets`
--
ALTER TABLE `manual_trip_sheets`
  ADD PRIMARY KEY (`id`),
  ADD KEY `manual_trip_sheets_po_id_foreign` (`po_id`),
  ADD KEY `manual_trip_sheets_trip_id_foreign` (`trip_id`),
  ADD KEY `manual_trip_sheets_truck_id_foreign` (`truck_id`),
  ADD KEY `manual_trip_sheets_driver_id_foreign` (`driver_id`);

--
-- Indexes for table `material_issues`
--
ALTER TABLE `material_issues`
  ADD PRIMARY KEY (`id`),
  ADD KEY `material_issues_division_id_foreign` (`division_id`),
  ADD KEY `material_issues_request_id_foreign` (`request_id`),
  ADD KEY `material_issues_received_by_foreign` (`received_by`);

--
-- Indexes for table `material_issue_returns`
--
ALTER TABLE `material_issue_returns`
  ADD PRIMARY KEY (`id`),
  ADD KEY `material_issue_returns_division_id_foreign` (`division_id`),
  ADD KEY `material_issue_returns_issue_id_foreign` (`issue_id`),
  ADD KEY `material_issue_returns_returned_by_foreign` (`returned_by`);

--
-- Indexes for table `material_issue_return_subs`
--
ALTER TABLE `material_issue_return_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `material_issue_return_subs_return_id_foreign` (`return_id`),
  ADD KEY `material_issue_return_subs_issue_id_foreign` (`issue_id`),
  ADD KEY `material_issue_return_subs_issue_sub_id_foreign` (`issue_sub_id`),
  ADD KEY `material_issue_return_subs_product_id_foreign` (`product_id`),
  ADD KEY `material_issue_return_subs_warehouse_id_foreign` (`warehouse_id`);

--
-- Indexes for table `material_issue_subs`
--
ALTER TABLE `material_issue_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `material_issue_subs_issue_id_foreign` (`issue_id`),
  ADD KEY `material_issue_subs_request_id_foreign` (`request_id`),
  ADD KEY `material_issue_subs_request_sub_id_foreign` (`request_sub_id`),
  ADD KEY `material_issue_subs_product_id_foreign` (`product_id`),
  ADD KEY `material_issue_subs_warehouse_id_foreign` (`warehouse_id`);

--
-- Indexes for table `material_requests`
--
ALTER TABLE `material_requests`
  ADD PRIMARY KEY (`id`),
  ADD KEY `material_requests_asset_id_foreign` (`asset_id`),
  ADD KEY `material_requests_work_id_foreign` (`work_id`),
  ADD KEY `material_requests_division_id_foreign` (`division_id`),
  ADD KEY `material_requests_job_id_foreign` (`job_id`),
  ADD KEY `material_requests_production_id_foreign` (`production_id`),
  ADD KEY `material_requests_workorder_id_foreign` (`workorder_id`),
  ADD KEY `material_requests_production_log_id_foreign` (`production_log_id`);

--
-- Indexes for table `material_request_subs`
--
ALTER TABLE `material_request_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `material_request_subs_request_id_foreign` (`request_id`),
  ADD KEY `material_request_subs_product_id_foreign` (`product_id`),
  ADD KEY `material_request_subs_production_id_foreign` (`production_id`),
  ADD KEY `material_request_subs_production_sub_id_foreign` (`production_sub_id`),
  ADD KEY `material_request_subs_brand_name_foreign` (`brand_name`),
  ADD KEY `material_request_subs_auom_id_foreign` (`auom_id`),
  ADD KEY `material_request_subs_warehouse_id_foreign` (`warehouse_id`);

--
-- Indexes for table `menuitems`
--
ALTER TABLE `menuitems`
  ADD PRIMARY KEY (`id`),
  ADD KEY `menuitems_menu_id_foreign` (`menu_id`);

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

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

--
-- Indexes for table `mobilemenuitems`
--
ALTER TABLE `mobilemenuitems`
  ADD PRIMARY KEY (`id`),
  ADD KEY `mobilemenuitems_menu_id_foreign` (`menu_id`);

--
-- Indexes for table `mobilemenupermissions`
--
ALTER TABLE `mobilemenupermissions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `mobilemenupermissions_form_id_foreign` (`form_id`),
  ADD KEY `mobilemenupermissions_user_id_foreign` (`user_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_id_model_type_index` (`model_id`,`model_type`);

--
-- 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_id_model_type_index` (`model_id`,`model_type`);

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

--
-- Indexes for table `monthly_holidays_subs`
--
ALTER TABLE `monthly_holidays_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `monthly_holidays_subs_main_id_foreign` (`main_id`);

--
-- Indexes for table `otherincomes`
--
ALTER TABLE `otherincomes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `otherincomes_group_company_id_foreign` (`group_company_id`),
  ADD KEY `otherincomes_division_id_foreign` (`division_id`),
  ADD KEY `otherincomes_customer_id_foreign` (`customer_id`),
  ADD KEY `otherincomes_salesperson_id_foreign` (`salesperson_id`),
  ADD KEY `otherincomes_paymentterm_id_foreign` (`paymentterm_id`),
  ADD KEY `otherincomes_branch_id_foreign` (`branch_id`),
  ADD KEY `otherincomes_vehicle_id_foreign` (`vehicle_id`),
  ADD KEY `otherincomes_gate_pass_id_foreign` (`gate_pass_id`),
  ADD KEY `otherincomes_receipt_id_foreign` (`receipt_id`);

--
-- Indexes for table `otherincomesubs`
--
ALTER TABLE `otherincomesubs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `otherincomesubs_main_id_foreign` (`main_id`),
  ADD KEY `otherincomesubs_otherincometype_id_foreign` (`otherincometype_id`),
  ADD KEY `otherincomesubs_uom_id_foreign` (`uom_id`),
  ADD KEY `otherincomesubs_tax_id_foreign` (`tax_id`);

--
-- Indexes for table `otherincometypes`
--
ALTER TABLE `otherincometypes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `otherincometypes_ledger_id_foreign` (`ledger_id`);

--
-- Indexes for table `outersalestrips`
--
ALTER TABLE `outersalestrips`
  ADD PRIMARY KEY (`id`),
  ADD KEY `outersalestrips_sales_id_foreign` (`sales_id`),
  ADD KEY `outersalestrips_trip_id_foreign` (`trip_id`),
  ADD KEY `outersalestrips_assign_truck_id_foreign` (`assign_truck_id`),
  ADD KEY `outersalestrips_shift_id_foreign` (`shift_id`),
  ADD KEY `outersalestrips_division_id_foreign` (`division_id`),
  ADD KEY `outersalestrips_po_id_foreign` (`po_id`);

--
-- Indexes for table `outersalestripsubs`
--
ALTER TABLE `outersalestripsubs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `outersalestripsubs_main_id_foreign` (`main_id`),
  ADD KEY `outersalestripsubs_product_id_foreign` (`product_id`),
  ADD KEY `outersalestripsubs_sales_sub_id_foreign` (`sales_sub_id`),
  ADD KEY `outersalestripsubs_sales_id_foreign` (`sales_id`),
  ADD KEY `outersalestripsubs_uom_id_foreign` (`uom_id`);

--
-- Indexes for table `outertriptrackings`
--
ALTER TABLE `outertriptrackings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `outertriptrackings_outertrip_id_foreign` (`outertrip_id`);

--
-- Indexes for table `outertrip_weightments`
--
ALTER TABLE `outertrip_weightments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `outertrip_weightments_outertrip_id_foreign` (`outertrip_id`),
  ADD KEY `outertrip_weightments_division_id_foreign` (`division_id`);

--
-- Indexes for table `outer_triploadings`
--
ALTER TABLE `outer_triploadings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `outer_triploadings_outertrip_id_foreign` (`outertrip_id`),
  ADD KEY `outer_triploadings_asset_id_foreign` (`asset_id`),
  ADD KEY `outer_triploadings_division_id_foreign` (`division_id`);

--
-- Indexes for table `over_times`
--
ALTER TABLE `over_times`
  ADD PRIMARY KEY (`id`),
  ADD KEY `over_times_division_id_foreign` (`division_id`),
  ADD KEY `over_times_salary_type_foreign` (`salary_type`);

--
-- Indexes for table `over_time_subs`
--
ALTER TABLE `over_time_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `over_time_subs_ot_id_foreign` (`ot_id`),
  ADD KEY `over_time_subs_emp_id_foreign` (`emp_id`),
  ADD KEY `over_time_subs_main_division_id_foreign` (`main_division_id`),
  ADD KEY `over_time_subs_salary_type_foreign` (`salary_type`),
  ADD KEY `over_time_subs_shift_id_foreign` (`shift_id`),
  ADD KEY `over_time_subs_sub_division_id_foreign` (`sub_division_id`);

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

--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
  ADD KEY `password_resets_email_index` (`email`);

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

--
-- Indexes for table `payment_vouchers`
--
ALTER TABLE `payment_vouchers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `payment_vouchers_division_id_foreign` (`division_id`),
  ADD KEY `payment_vouchers_main_ledger_id_foreign` (`main_ledger_id`),
  ADD KEY `payment_vouchers_group_company_id_foreign` (`group_company_id`),
  ADD KEY `payment_vouchers_schedulepayment_id_foreign` (`schedulepayment_id`),
  ADD KEY `payment_vouchers_receipt_id_foreign` (`receipt_id`),
  ADD KEY `payment_vouchers_schedule_payment_id_foreign` (`schedule_payment_id`);

--
-- Indexes for table `payment_voucher_subs`
--
ALTER TABLE `payment_voucher_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `payment_voucher_subs_payment_voucher_id_foreign` (`payment_voucher_id`),
  ADD KEY `payment_voucher_subs_ledger_id_foreign` (`ledger_id`),
  ADD KEY `payment_voucher_subs_asset_id_foreign` (`asset_id`),
  ADD KEY `payment_voucher_subs_supplier_id_foreign` (`supplier_id`);

--
-- Indexes for table `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `permissions_name_guard_name_unique` (`name`,`guard_name`),
  ADD KEY `permissions_form_id_foreign` (`form_id`);

--
-- Indexes for table `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  ADD KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`);

--
-- Indexes for table `privatevehiclemobiles`
--
ALTER TABLE `privatevehiclemobiles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `privatevehiclemobiles_main_id_foreign` (`main_id`);

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

--
-- Indexes for table `productcategories`
--
ALTER TABLE `productcategories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `productcategories_category_name_unique` (`category_name`),
  ADD UNIQUE KEY `productcategories_category_code_unique` (`category_code`);

--
-- Indexes for table `productionroutings`
--
ALTER TABLE `productionroutings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `productionroutings_division_id_foreign` (`division_id`);

--
-- Indexes for table `productionroutingsubs`
--
ALTER TABLE `productionroutingsubs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `productionroutingsubs_main_id_foreign` (`main_id`),
  ADD KEY `productionroutingsubs_workcenter_id_foreign` (`workcenter_id`),
  ADD KEY `productionroutingsubs_machinecenter_id_foreign` (`machinecenter_id`);

--
-- Indexes for table `production_orders`
--
ALTER TABLE `production_orders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `production_orders_bom_id_foreign` (`bom_id`),
  ADD KEY `production_orders_division_id_foreign` (`division_id`),
  ADD KEY `production_orders_product_id_foreign` (`product_id`),
  ADD KEY `production_orders_sales_id_foreign` (`sales_id`),
  ADD KEY `production_orders_emp_id_foreign` (`emp_id`),
  ADD KEY `production_orders_routing_id_foreign` (`routing_id`),
  ADD KEY `production_orders_uom_id_foreign` (`uom_id`);

--
-- Indexes for table `production_order_logs`
--
ALTER TABLE `production_order_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `production_order_logs_production_order_id_foreign` (`production_order_id`),
  ADD KEY `production_order_logs_warehouse_id_foreign` (`warehouse_id`);

--
-- Indexes for table `production_order_log_fixed_costs`
--
ALTER TABLE `production_order_log_fixed_costs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `production_order_log_fixed_costs_production_order_id_foreign` (`production_order_id`),
  ADD KEY `production_order_log_fixed_costs_production_log_id_foreign` (`production_log_id`),
  ADD KEY `production_order_log_fixed_costs_work_center_id_foreign` (`work_center_id`);

--
-- Indexes for table `production_order_log_machine_cenetrs`
--
ALTER TABLE `production_order_log_machine_cenetrs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `production_order_log_machine_cenetrs_production_order_id_foreign` (`production_order_id`),
  ADD KEY `production_order_log_machine_cenetrs_production_log_id_foreign` (`production_log_id`),
  ADD KEY `production_order_log_machine_cenetrs_work_center_id_foreign` (`work_center_id`),
  ADD KEY `production_order_log_machine_cenetrs_machine_center_id_foreign` (`machine_center_id`);

--
-- Indexes for table `production_order_log_work_cenetrs`
--
ALTER TABLE `production_order_log_work_cenetrs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `production_order_log_work_cenetrs_production_order_id_foreign` (`production_order_id`),
  ADD KEY `production_order_log_work_cenetrs_production_log_id_foreign` (`production_log_id`),
  ADD KEY `production_order_log_work_cenetrs_work_center_id_foreign` (`work_center_id`);

--
-- Indexes for table `production_order_machine_centers`
--
ALTER TABLE `production_order_machine_centers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `production_order_machine_centers_production_order_id_foreign` (`production_order_id`),
  ADD KEY `production_order_machine_centers_work_center_id_foreign` (`work_center_id`),
  ADD KEY `production_order_machine_centers_machine_center_id_foreign` (`machine_center_id`);

--
-- Indexes for table `production_order_subs`
--
ALTER TABLE `production_order_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `production_order_subs_production_order_id_foreign` (`production_order_id`),
  ADD KEY `production_order_subs_bom_sub_id_foreign` (`bom_sub_id`),
  ADD KEY `production_order_subs_product_id_foreign` (`product_id`),
  ADD KEY `production_order_subs_uom_id_foreign` (`uom_id`);

--
-- Indexes for table `production_order_trackings`
--
ALTER TABLE `production_order_trackings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `production_order_trackings_order_id_foreign` (`order_id`);

--
-- Indexes for table `production_order_work_centers`
--
ALTER TABLE `production_order_work_centers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `production_order_work_centers_production_order_id_foreign` (`production_order_id`),
  ADD KEY `production_order_work_centers_work_center_id_foreign` (`work_center_id`);

--
-- Indexes for table `production_routing_machines`
--
ALTER TABLE `production_routing_machines`
  ADD PRIMARY KEY (`id`),
  ADD KEY `production_routing_machines_main_id_foreign` (`main_id`),
  ADD KEY `production_routing_machines_workcenter_id_foreign` (`workcenter_id`),
  ADD KEY `production_routing_machines_machinecenter_id_foreign` (`machinecenter_id`);

--
-- Indexes for table `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`),
  ADD KEY `products_product_group_id_foreign` (`product_group_id`),
  ADD KEY `products_uom_id_foreign` (`uom_id`),
  ADD KEY `products_sales_ledger_id_foreign` (`sales_ledger_id`),
  ADD KEY `products_purchase_ledger_id_foreign` (`purchase_ledger_id`),
  ADD KEY `products_inventory_ledger_id_foreign` (`inventory_ledger_id`);

--
-- Indexes for table `productstandard_consumptions`
--
ALTER TABLE `productstandard_consumptions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `productstandard_consumptions_product_id_foreign` (`product_id`),
  ADD KEY `productstandard_consumptions_uom_id_foreign` (`uom_id`);

--
-- Indexes for table `productuoms`
--
ALTER TABLE `productuoms`
  ADD PRIMARY KEY (`id`),
  ADD KEY `productuoms_product_id_foreign` (`product_id`),
  ADD KEY `productuoms_auom_id_foreign` (`auom_id`),
  ADD KEY `productuoms_uom_foreign` (`uom`);

--
-- Indexes for table `product_costs`
--
ALTER TABLE `product_costs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_costs_product_id_foreign` (`product_id`),
  ADD KEY `product_costs_cost_id_foreign` (`cost_id`);

--
-- Indexes for table `product_cost_types`
--
ALTER TABLE `product_cost_types`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `product_cost_types_name_unique` (`name`),
  ADD KEY `product_cost_types_ledger_id_foreign` (`ledger_id`);

--
-- Indexes for table `product_groups`
--
ALTER TABLE `product_groups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_groups_category_id_foreign` (`category_id`);

--
-- Indexes for table `product_routings`
--
ALTER TABLE `product_routings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_routings_division_id_foreign` (`division_id`),
  ADD KEY `product_routings_product_id_foreign` (`product_id`),
  ADD KEY `product_routings_uom_id_foreign` (`uom_id`);

--
-- Indexes for table `product_routing_subs`
--
ALTER TABLE `product_routing_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_routing_subs_route_id_foreign` (`route_id`),
  ADD KEY `product_routing_subs_workcenter_id_foreign` (`workcenter_id`);

--
-- Indexes for table `product_vendors_subs`
--
ALTER TABLE `product_vendors_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_vendors_subs_product_id_foreign` (`product_id`),
  ADD KEY `product_vendors_subs_vendor_id_foreign` (`vendor_id`);

--
-- Indexes for table `projectcompletions`
--
ALTER TABLE `projectcompletions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `projectcompletions_project_id_foreign` (`project_id`);

--
-- Indexes for table `projectcompletionsubs`
--
ALTER TABLE `projectcompletionsubs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `projectcompletionsubs_main_id_foreign` (`main_id`),
  ADD KEY `projectcompletionsubs_product_id_foreign` (`product_id`),
  ADD KEY `projectcompletionsubs_estimated_qty_uom_id_foreign` (`estimated_qty_uom_id`),
  ADD KEY `projectcompletionsubs_dc_qty_uom_id_foreign` (`dc_qty_uom_id`);

--
-- Indexes for table `projectcreations`
--
ALTER TABLE `projectcreations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `projectcreations_customer_id_foreign` (`customer_id`),
  ADD KEY `projectcreations_division_id_foreign` (`division_id`),
  ADD KEY `projectcreations_layingsite_id_foreign` (`layingsite_id`),
  ADD KEY `projectcreations_officesite_id_foreign` (`officesite_id`),
  ADD KEY `projectcreations_executive_id_foreign` (`executive_id`),
  ADD KEY `projectcreations_contractor_id_foreign` (`contractor_id`),
  ADD KEY `projectcreations_projectcompletion_id_foreign` (`projectcompletion_id`);

--
-- Indexes for table `project_measurement_details`
--
ALTER TABLE `project_measurement_details`
  ADD PRIMARY KEY (`id`),
  ADD KEY `project_measurement_details_project_id_foreign` (`project_id`),
  ADD KEY `project_measurement_details_measured_by_foreign` (`measured_by`);

--
-- Indexes for table `purchasebooks`
--
ALTER TABLE `purchasebooks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchasebooks_division_id_foreign` (`division_id`),
  ADD KEY `purchasebooks_supplier_id_foreign` (`supplier_id`),
  ADD KEY `purchasebooks_product_id_foreign` (`product_id`);

--
-- Indexes for table `purchasereturns`
--
ALTER TABLE `purchasereturns`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchasereturns_supplier_id_foreign` (`supplier_id`),
  ADD KEY `purchasereturns_division_id_foreign` (`division_id`),
  ADD KEY `purchasereturns_grnbill_id_foreign` (`grnbill_id`),
  ADD KEY `purchasereturns_group_company_id_foreign` (`group_company_id`),
  ADD KEY `purchasereturns_ledger_id_foreign` (`ledger_id`);

--
-- Indexes for table `purchasereturn_subs`
--
ALTER TABLE `purchasereturn_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchasereturn_subs_main_id_foreign` (`main_id`),
  ADD KEY `purchasereturn_subs_product_id_foreign` (`product_id`),
  ADD KEY `purchasereturn_subs_grnbillsub_id_foreign` (`grnbillsub_id`);

--
-- Indexes for table `purchase_advances`
--
ALTER TABLE `purchase_advances`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_advances_emp_id_foreign` (`emp_id`),
  ADD KEY `purchase_advances_division_id_foreign` (`division_id`),
  ADD KEY `purchase_advances_group_company_foreign` (`group_company`),
  ADD KEY `purchase_advances_paid_id_foreign` (`paid_id`),
  ADD KEY `purchase_advances_paid_ledger_id_foreign` (`paid_ledger_id`);

--
-- Indexes for table `purchase_advance_revises`
--
ALTER TABLE `purchase_advance_revises`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_advance_revises_purchase_advance_id_foreign` (`purchase_advance_id`),
  ADD KEY `purchase_advance_revises_cash_paid_ledger_foreign` (`cash_paid_ledger`);

--
-- Indexes for table `purchase_advance_revise_subs`
--
ALTER TABLE `purchase_advance_revise_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_advance_revise_subs_purchase_advance_revise_id_foreign` (`purchase_advance_revise_id`),
  ADD KEY `purchase_advance_revise_subs_ledger_id_foreign` (`ledger_id`);

--
-- Indexes for table `purchase_orders`
--
ALTER TABLE `purchase_orders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_orders_supplier_id_foreign` (`supplier_id`),
  ADD KEY `purchase_orders_delivery_id_foreign` (`delivery_id`),
  ADD KEY `purchase_orders_billing_address_id_foreign` (`billing_address_id`),
  ADD KEY `purchase_orders_other_id_foreign` (`other_id`),
  ADD KEY `purchase_orders_bill_address_id_foreign` (`bill_address_id`),
  ADD KEY `purchase_orders_ship_address_id_foreign` (`ship_address_id`);

--
-- Indexes for table `purchase_order_subs`
--
ALTER TABLE `purchase_order_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_order_subs_purchase_order_id_foreign` (`purchase_order_id`),
  ADD KEY `purchase_order_subs_product_id_foreign` (`product_id`),
  ADD KEY `purchase_order_subs_uom_id_foreign` (`uom_id`),
  ADD KEY `purchase_order_subs_brand_name_foreign` (`brand_name`);

--
-- Indexes for table `purchase_order_trackings`
--
ALTER TABLE `purchase_order_trackings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_order_trackings_order_id_foreign` (`order_id`);

--
-- Indexes for table `purchase_quotations`
--
ALTER TABLE `purchase_quotations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_quotations_purchase_id_foreign` (`purchase_id`);

--
-- Indexes for table `purchase_requests`
--
ALTER TABLE `purchase_requests`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_requests_division_id_foreign` (`division_id`),
  ADD KEY `purchase_requests_inter_from_division_foreign` (`inter_from_division`);

--
-- Indexes for table `purchase_request_subs`
--
ALTER TABLE `purchase_request_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_request_subs_purchase_id_foreign` (`purchase_id`),
  ADD KEY `purchase_request_subs_product_id_foreign` (`product_id`),
  ADD KEY `purchase_request_subs_request_sub_id_foreign` (`request_sub_id`),
  ADD KEY `purchase_request_subs_uom_id_foreign` (`uom_id`);

--
-- Indexes for table `receiptadjustment_subs`
--
ALTER TABLE `receiptadjustment_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `receiptadjustment_subs_main_id_foreign` (`main_id`);

--
-- Indexes for table `receipt_vouchers`
--
ALTER TABLE `receipt_vouchers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `receipt_vouchers_group_company_id_foreign` (`group_company_id`),
  ADD KEY `receipt_vouchers_division_id_foreign` (`division_id`),
  ADD KEY `receipt_vouchers_main_ledger_id_foreign` (`main_ledger_id`);

--
-- Indexes for table `receipt_voucher_subs`
--
ALTER TABLE `receipt_voucher_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `receipt_voucher_subs_receipt_voucher_id_foreign` (`receipt_voucher_id`),
  ADD KEY `receipt_voucher_subs_ledger_id_foreign` (`ledger_id`),
  ADD KEY `receipt_voucher_subs_asset_id_foreign` (`asset_id`),
  ADD KEY `receipt_voucher_subs_supplier_id_foreign` (`supplier_id`);

--
-- Indexes for table `refundforms`
--
ALTER TABLE `refundforms`
  ADD PRIMARY KEY (`id`),
  ADD KEY `refundforms_customer_id_foreign` (`customer_id`),
  ADD KEY `refundforms_division_id_foreign` (`division_id`),
  ADD KEY `refundforms_ledger_id_foreign` (`ledger_id`),
  ADD KEY `refundforms_groupcompany_id_foreign` (`groupcompany_id`),
  ADD KEY `refundforms_receipt_id_foreign` (`receipt_id`),
  ADD KEY `refundforms_creditnote_id_foreign` (`creditnote_id`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `roles_name_guard_name_unique` (`name`,`guard_name`);

--
-- 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 `salary_creations`
--
ALTER TABLE `salary_creations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salary_creations_division_id_foreign` (`division_id`),
  ADD KEY `salary_creations_salary_type_foreign` (`salary_type`);

--
-- Indexes for table `salary_creation_components_subs`
--
ALTER TABLE `salary_creation_components_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salary_creation_components_subs_salary_id_foreign` (`salary_id`),
  ADD KEY `salary_creation_components_subs_salary_sub_id_foreign` (`salary_sub_id`),
  ADD KEY `salary_creation_components_subs_emp_id_foreign` (`emp_id`);

--
-- Indexes for table `salary_creation_subs`
--
ALTER TABLE `salary_creation_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salary_creation_subs_salary_id_foreign` (`salary_id`),
  ADD KEY `salary_creation_subs_emp_id_foreign` (`emp_id`),
  ADD KEY `salary_creation_subs_division_id_foreign` (`division_id`),
  ADD KEY `salary_creation_subs_salary_type_foreign` (`salary_type`);

--
-- Indexes for table `salary_pays`
--
ALTER TABLE `salary_pays`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salary_pays_salary_id_foreign` (`salary_id`),
  ADD KEY `salary_pays_group_company_id_foreign` (`group_company_id`),
  ADD KEY `salary_pays_paid_id_foreign` (`paid_id`);

--
-- Indexes for table `salary_pay_subs`
--
ALTER TABLE `salary_pay_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salary_pay_subs_salary_pay_id_foreign` (`salary_pay_id`),
  ADD KEY `salary_pay_subs_salary_id_foreign` (`salary_id`),
  ADD KEY `salary_pay_subs_salary_sub_id_foreign` (`salary_sub_id`),
  ADD KEY `salary_pay_subs_emp_id_foreign` (`emp_id`);

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

--
-- Indexes for table `salescosts`
--
ALTER TABLE `salescosts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salescosts_salesorder_id_foreign` (`salesorder_id`),
  ADD KEY `salescosts_dc_id_foreign` (`dc_id`),
  ADD KEY `salescosts_costtype_id_foreign` (`costtype_id`),
  ADD KEY `salescosts_inter_trip_inward_id_foreign` (`inter_trip_inward_id`),
  ADD KEY `salescosts_sales_return_receive_id_foreign` (`sales_return_receive_id`);

--
-- Indexes for table `salesdiscounts`
--
ALTER TABLE `salesdiscounts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salesdiscounts_salesperson_id_foreign` (`salesperson_id`),
  ADD KEY `salesdiscounts_branch_id_foreign` (`branch_id`),
  ADD KEY `salesdiscounts_customer_id_foreign` (`customer_id`),
  ADD KEY `salesdiscounts_discountreason_id_foreign` (`discountreason_id`);

--
-- Indexes for table `salesdiscountsubs`
--
ALTER TABLE `salesdiscountsubs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salesdiscountsubs_main_id_foreign` (`main_id`),
  ADD KEY `salesdiscountsubs_division_id_foreign` (`division_id`);

--
-- Indexes for table `salesgateins`
--
ALTER TABLE `salesgateins`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salesgateins_outertrip_id_foreign` (`outertrip_id`),
  ADD KEY `salesgateins_assign_truck_id_foreign` (`assign_truck_id`),
  ADD KEY `salesgateins_truck_id_foreign` (`truck_id`),
  ADD KEY `salesgateins_salesreturn_id_foreign` (`salesreturn_id`);

--
-- Indexes for table `salesinvoices`
--
ALTER TABLE `salesinvoices`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salesinvoices_customer_id_foreign` (`customer_id`),
  ADD KEY `salesinvoices_division_id_foreign` (`division_id`),
  ADD KEY `salesinvoices_billing_id_foreign` (`billing_id`),
  ADD KEY `salesinvoices_shipping_id_foreign` (`shipping_id`),
  ADD KEY `salesinvoices_dc_id_foreign` (`dc_id`);

--
-- Indexes for table `salesinvoicesubs`
--
ALTER TABLE `salesinvoicesubs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salesinvoicesubs_main_id_foreign` (`main_id`),
  ADD KEY `salesinvoicesubs_product_id_foreign` (`product_id`),
  ADD KEY `salesinvoicesubs_uom_id_foreign` (`uom_id`),
  ADD KEY `salesinvoicesubs_salesdc_subid_foreign` (`salesdc_subid`),
  ADD KEY `salesinvoicesubs_tax_id_foreign` (`tax_id`);

--
-- Indexes for table `salesorders`
--
ALTER TABLE `salesorders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salesorders_customer_id_foreign` (`customer_id`),
  ADD KEY `salesorders_deliverysite_id_foreign` (`deliverysite_id`),
  ADD KEY `salesorders_branch_id_foreign` (`branch_id`),
  ADD KEY `salesorders_division_id_foreign` (`division_id`),
  ADD KEY `salesorders_salesperson_id_foreign` (`salesperson_id`),
  ADD KEY `salesorders_paymentterm_id_foreign` (`paymentterm_id`),
  ADD KEY `salesorders_tax_id_foreign` (`tax_id`),
  ADD KEY `salesorders_po_id_foreign` (`po_id`),
  ADD KEY `salesorders_unloading_type_id_foreign` (`unloading_type_id`),
  ADD KEY `salesorders_estimation_id_foreign` (`estimation_id`);

--
-- Indexes for table `salesorder_subs`
--
ALTER TABLE `salesorder_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salesorder_subs_main_id_foreign` (`main_id`),
  ADD KEY `salesorder_subs_product_id_foreign` (`product_id`),
  ADD KEY `salesorder_subs_tax_id_foreign` (`tax_id`),
  ADD KEY `salesorder_subs_uom_id_foreign` (`uom_id`),
  ADD KEY `salesorder_subs_estimation_sub_id_foreign` (`estimation_sub_id`);

--
-- Indexes for table `salesorder_vehicles`
--
ALTER TABLE `salesorder_vehicles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salesorder_vehicles_sales_id_foreign` (`sales_id`),
  ADD KEY `salesorder_vehicles_dispatch_id_foreign` (`dispatch_id`),
  ADD KEY `salesorder_vehicles_division_id_foreign` (`division_id`);

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

--
-- Indexes for table `salesreturnreceives`
--
ALTER TABLE `salesreturnreceives`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salesreturnreceives_salesreturn_id_foreign` (`salesreturn_id`),
  ADD KEY `salesreturnreceives_return_trip_id_foreign` (`return_trip_id`),
  ADD KEY `salesreturnreceives_return_trip_sub_id_foreign` (`return_trip_sub_id`);

--
-- Indexes for table `salesreturnreceivesubs`
--
ALTER TABLE `salesreturnreceivesubs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salesreturnreceivesubs_main_id_foreign` (`main_id`),
  ADD KEY `salesreturnreceivesubs_salesreturn_subid_foreign` (`salesreturn_subid`),
  ADD KEY `salesreturnreceivesubs_salesreturn_id_foreign` (`salesreturn_id`),
  ADD KEY `salesreturnreceivesubs_product_id_foreign` (`product_id`),
  ADD KEY `salesreturnreceivesubs_warehouse_id_acc_foreign` (`warehouse_id_acc`),
  ADD KEY `salesreturnreceivesubs_warehouse_id_rej_foreign` (`warehouse_id_rej`);

--
-- Indexes for table `salesreturns`
--
ALTER TABLE `salesreturns`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salesreturns_customer_id_foreign` (`customer_id`),
  ADD KEY `salesreturns_division_id_foreign` (`division_id`),
  ADD KEY `salesreturns_truck_id_foreign` (`truck_id`),
  ADD KEY `salesreturns_salesorder_id_foreign` (`salesorder_id`),
  ADD KEY `salesreturns_group_company_id_foreign` (`group_company_id`),
  ADD KEY `salesreturns_salesperson_id_foreign` (`salesperson_id`);

--
-- Indexes for table `salesreturnsubs`
--
ALTER TABLE `salesreturnsubs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salesreturnsubs_main_id_foreign` (`main_id`),
  ADD KEY `salesreturnsubs_product_id_foreign` (`product_id`),
  ADD KEY `salesreturnsubs_reason_foreign` (`reason`),
  ADD KEY `salesreturnsubs_salesorder_subid_foreign` (`salesorder_subid`),
  ADD KEY `salesreturnsubs_salesorder_id_foreign` (`salesorder_id`);

--
-- Indexes for table `sales_dcs`
--
ALTER TABLE `sales_dcs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sales_dcs_outertrip_id_foreign` (`outertrip_id`),
  ADD KEY `sales_dcs_sales_id_foreign` (`sales_id`),
  ADD KEY `sales_dcs_customer_id_foreign` (`customer_id`),
  ADD KEY `sales_dcs_deliverysite_id_foreign` (`deliverysite_id`),
  ADD KEY `sales_dcs_salesperson_id_foreign` (`salesperson_id`),
  ADD KEY `sales_dcs_branch_id_foreign` (`branch_id`),
  ADD KEY `sales_dcs_division_id_foreign` (`division_id`),
  ADD KEY `sales_dcs_paymentterm_id_foreign` (`paymentterm_id`),
  ADD KEY `sales_dcs_tax_id_foreign` (`tax_id`),
  ADD KEY `sales_dcs_groupcompany_id_foreign` (`groupcompany_id`),
  ADD KEY `entry_date` (`entry_date`);

--
-- Indexes for table `sales_dc_subs`
--
ALTER TABLE `sales_dc_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sales_dc_subs_main_id_foreign` (`main_id`),
  ADD KEY `sales_dc_subs_sales_sub_id_foreign` (`sales_sub_id`),
  ADD KEY `sales_dc_subs_outertrip_sub_id_foreign` (`outertrip_sub_id`),
  ADD KEY `sales_dc_subs_product_id_foreign` (`product_id`),
  ADD KEY `sales_dc_subs_tax_id_foreign` (`tax_id`),
  ADD KEY `sales_dc_subs_uom_id_foreign` (`uom_id`);

--
-- Indexes for table `sales_return_trips`
--
ALTER TABLE `sales_return_trips`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sales_return_trips_trip_id_foreign` (`trip_id`),
  ADD KEY `sales_return_trips_assign_truck_id_foreign` (`assign_truck_id`),
  ADD KEY `sales_return_trips_shift_id_foreign` (`shift_id`);

--
-- Indexes for table `sales_return_trip_subs`
--
ALTER TABLE `sales_return_trip_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sales_return_trip_subs_main_id_foreign` (`main_id`),
  ADD KEY `sales_return_trip_subs_sales_return_id_foreign` (`sales_return_id`),
  ADD KEY `sales_return_trip_subs_division_id_foreign` (`division_id`);

--
-- Indexes for table `sales_return_trip_trackings`
--
ALTER TABLE `sales_return_trip_trackings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sales_return_trip_trackings_outertrip_id_foreign` (`outertrip_id`);

--
-- Indexes for table `schedulepayments`
--
ALTER TABLE `schedulepayments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `schedulepayments_loan_account_id_foreign` (`loan_account_id`),
  ADD KEY `schedulepayments_paid_through_foreign` (`paid_through`),
  ADD KEY `schedulepayments_asset_id_foreign` (`asset_id`),
  ADD KEY `schedulepayments_group_company_id_foreign` (`group_company_id`),
  ADD KEY `schedulepayments_division_id_foreign` (`division_id`),
  ADD KEY `schedulepayments_payment_id_foreign` (`payment_id`),
  ADD KEY `schedulepayments_schedule_type_id_foreign` (`schedule_type_id`);

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

--
-- Indexes for table `schedule_payment_month_wises`
--
ALTER TABLE `schedule_payment_month_wises`
  ADD PRIMARY KEY (`id`),
  ADD KEY `schedule_payment_month_wises_schedule_payment_id_foreign` (`schedule_payment_id`),
  ADD KEY `schedule_payment_month_wises_asset_id_foreign` (`asset_id`),
  ADD KEY `schedule_payment_month_wises_payment_id_foreign` (`payment_id`);

--
-- Indexes for table `service_bills`
--
ALTER TABLE `service_bills`
  ADD PRIMARY KEY (`id`),
  ADD KEY `service_bills_supplier_id_foreign` (`supplier_id`),
  ADD KEY `service_bills_division_id_foreign` (`division_id`),
  ADD KEY `service_bills_other_id_foreign` (`other_id`),
  ADD KEY `service_bills_tcs_id_foreign` (`tcs_id`),
  ADD KEY `service_bills_group_company_id_foreign` (`group_company_id`),
  ADD KEY `service_bills_expense_type_id_foreign` (`expense_type_id`),
  ADD KEY `service_bills_job_card_id_foreign` (`job_card_id`),
  ADD KEY `service_bills_tds_ledger_foreign` (`tds_ledger`),
  ADD KEY `service_bills_tds_id_foreign` (`tds_id`),
  ADD KEY `service_bills_asset_id_foreign` (`asset_id`);

--
-- Indexes for table `service_bill_subs`
--
ALTER TABLE `service_bill_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `service_bill_subs_service_bill_id_foreign` (`service_bill_id`),
  ADD KEY `service_bill_subs_uom_id_foreign` (`uom_id`),
  ADD KEY `service_bill_subs_hsn_id_foreign` (`hsn_id`);

--
-- Indexes for table `service_bill_uploads`
--
ALTER TABLE `service_bill_uploads`
  ADD PRIMARY KEY (`id`),
  ADD KEY `service_bill_uploads_bill_id_foreign` (`bill_id`);

--
-- Indexes for table `service_histories`
--
ALTER TABLE `service_histories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `service_histories_refer_id_foreign` (`refer_id`),
  ADD KEY `service_histories_assetgroup_foreign` (`assetgroup`),
  ADD KEY `service_histories_asset_id_foreign` (`asset_id`),
  ADD KEY `service_histories_service_name_foreign` (`service_name`),
  ADD KEY `service_histories_incharge_id_foreign` (`incharge_id`),
  ADD KEY `service_histories_job_card_id_foreign` (`job_card_id`);

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

--
-- Indexes for table `service_schedules`
--
ALTER TABLE `service_schedules`
  ADD PRIMARY KEY (`id`),
  ADD KEY `service_schedules_assetgroup_foreign` (`assetgroup`),
  ADD KEY `service_schedules_asset_id_foreign` (`asset_id`),
  ADD KEY `service_schedules_service_name_foreign` (`service_name`);

--
-- Indexes for table `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

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

--
-- Indexes for table `staffbranches`
--
ALTER TABLE `staffbranches`
  ADD PRIMARY KEY (`id`),
  ADD KEY `staffbranches_staff_id_foreign` (`staff_id`);

--
-- Indexes for table `standard_boms`
--
ALTER TABLE `standard_boms`
  ADD PRIMARY KEY (`id`),
  ADD KEY `standard_boms_division_id_foreign` (`division_id`),
  ADD KEY `standard_boms_product_id_foreign` (`product_id`),
  ADD KEY `standard_boms_uom_id_foreign` (`uom_id`);

--
-- Indexes for table `standard_bom_subs`
--
ALTER TABLE `standard_bom_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `standard_bom_subs_main_id_foreign` (`main_id`),
  ADD KEY `standard_bom_subs_product_id_foreign` (`product_id`),
  ADD KEY `standard_bom_subs_uom_id_foreign` (`uom_id`);

--
-- Indexes for table `stockadjustments`
--
ALTER TABLE `stockadjustments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stockadjustments_division_id_foreign` (`division_id`),
  ADD KEY `stockadjustments_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `stockadjustments_reason_id_foreign` (`reason_id`);

--
-- Indexes for table `stockadjustment_subs`
--
ALTER TABLE `stockadjustment_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stockadjustment_subs_main_id_foreign` (`main_id`),
  ADD KEY `stockadjustment_subs_product_id_foreign` (`product_id`),
  ADD KEY `stockadjustment_subs_brand_name_foreign` (`brand_name`),
  ADD KEY `stockadjustment_subs_warehouse_id_foreign` (`warehouse_id`);

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

--
-- Indexes for table `stocks`
--
ALTER TABLE `stocks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stocks_product_id_foreign` (`product_id`),
  ADD KEY `stocks_division_id_foreign` (`division_id`),
  ADD KEY `stocks_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `stocks_brand_name_foreign` (`brand_name`),
  ADD KEY `stocks_uom_id_foreign` (`uom_id`),
  ADD KEY `stocks_purchase_uom_id_foreign` (`purchase_uom_id`),
  ADD KEY `entry_date` (`entry_date`);

--
-- Indexes for table `stocktransfers`
--
ALTER TABLE `stocktransfers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stocktransfers_source_division_id_foreign` (`source_division_id`),
  ADD KEY `stocktransfers_source_warehouse_id_foreign` (`source_warehouse_id`),
  ADD KEY `stocktransfers_destination_division_id_foreign` (`destination_division_id`),
  ADD KEY `stocktransfers_destination_warehouse_id_foreign` (`destination_warehouse_id`);

--
-- Indexes for table `stocktransfer_subs`
--
ALTER TABLE `stocktransfer_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stocktransfer_subs_main_id_foreign` (`main_id`),
  ADD KEY `stocktransfer_subs_product_id_foreign` (`product_id`),
  ADD KEY `stocktransfer_subs_brand_name_foreign` (`brand_name`),
  ADD KEY `stocktransfer_subs_warehouse_id_source_foreign` (`warehouse_id_source`),
  ADD KEY `stocktransfer_subs_warehouse_id_destination_foreign` (`warehouse_id_destination`);

--
-- Indexes for table `stock_locations`
--
ALTER TABLE `stock_locations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_locations_division_id_foreign` (`division_id`),
  ADD KEY `stock_locations_warehouse_id_foreign` (`warehouse_id`);

--
-- Indexes for table `supplierrefunds`
--
ALTER TABLE `supplierrefunds`
  ADD PRIMARY KEY (`id`),
  ADD KEY `supplierrefunds_supplier_id_foreign` (`supplier_id`),
  ADD KEY `supplierrefunds_division_id_foreign` (`division_id`),
  ADD KEY `supplierrefunds_ledger_id_foreign` (`ledger_id`),
  ADD KEY `supplierrefunds_groupcompany_id_foreign` (`groupcompany_id`),
  ADD KEY `supplierrefunds_payment_id_foreign` (`payment_id`),
  ADD KEY `supplierrefunds_debitnote_id_foreign` (`debitnote_id`);

--
-- Indexes for table `suppliers`
--
ALTER TABLE `suppliers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `suppliers_supplier_name_unique` (`supplier_name`),
  ADD UNIQUE KEY `suppliers_supplier_code_unique` (`supplier_code`),
  ADD UNIQUE KEY `suppliers_contact_no_unique` (`contact_no`),
  ADD UNIQUE KEY `suppliers_email_unique` (`email`),
  ADD KEY `suppliers_payment_terms_id_foreign` (`payment_terms_id`);

--
-- Indexes for table `supplier_transactions`
--
ALTER TABLE `supplier_transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `supplier_transactions_supplier_id_foreign` (`supplier_id`),
  ADD KEY `supplier_transactions_division_id_foreign` (`division_id`),
  ADD KEY `supplier_transactions_groupcompany_id_foreign` (`groupcompany_id`);

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

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

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

--
-- Indexes for table `ticket_rises`
--
ALTER TABLE `ticket_rises`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ticket_rises_approved_by_foreign` (`approved_by`);

--
-- Indexes for table `ticket_rise_replies`
--
ALTER TABLE `ticket_rise_replies`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ticket_rise_replies_rise_id_foreign` (`rise_id`);

--
-- Indexes for table `transport_routings`
--
ALTER TABLE `transport_routings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `transport_routings_division_id_foreign` (`division_id`),
  ADD KEY `transport_routings_asset_id_foreign` (`asset_id`),
  ADD KEY `transport_routings_uom_id_foreign` (`uom_id`);

--
-- Indexes for table `transport_routing_subs`
--
ALTER TABLE `transport_routing_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `transport_routing_subs_route_id_foreign` (`route_id`),
  ADD KEY `transport_routing_subs_workcenter_id_foreign` (`workcenter_id`);

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

--
-- Indexes for table `truckassigns`
--
ALTER TABLE `truckassigns`
  ADD PRIMARY KEY (`id`),
  ADD KEY `truckassigns_shift_id_foreign` (`shift_id`),
  ADD KEY `truckassigns_truck_id_foreign` (`truck_id`),
  ADD KEY `truckassigns_driver_id_foreign` (`driver_id`),
  ADD KEY `truckassigns_job_card_id_foreign` (`job_card_id`),
  ADD KEY `truckassigns_parked_site_id_foreign` (`parked_site_id`);

--
-- Indexes for table `uoms`
--
ALTER TABLE `uoms`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uoms_uom_unique` (`uom`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `users_username_unique` (`username`),
  ADD KEY `users_emp_id_foreign` (`emp_id`);

--
-- Indexes for table `vehiclemeterreadings`
--
ALTER TABLE `vehiclemeterreadings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vehiclemeterreadings_vehicle_id_foreign` (`vehicle_id`);

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

--
-- Indexes for table `vendoropening_balances`
--
ALTER TABLE `vendoropening_balances`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vendoropening_balances_supplier_id_foreign` (`supplier_id`),
  ADD KEY `vendoropening_balances_division_id_foreign` (`division_id`);

--
-- Indexes for table `vendor_bills`
--
ALTER TABLE `vendor_bills`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vendor_bills_supplier_id_foreign` (`supplier_id`),
  ADD KEY `vendor_bills_division_id_foreign` (`division_id`),
  ADD KEY `vendor_bills_groupcompany_id_foreign` (`groupcompany_id`),
  ADD KEY `bill_id` (`bill_id`);

--
-- Indexes for table `vendor_payments`
--
ALTER TABLE `vendor_payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vendor_payments_supplier_id_foreign` (`supplier_id`),
  ADD KEY `vendor_payments_ledger_id_foreign` (`ledger_id`),
  ADD KEY `vendor_payments_division_id_foreign` (`division_id`),
  ADD KEY `vendor_payments_groupcompany_id_foreign` (`groupcompany_id`),
  ADD KEY `vendor_payments_project_id_foreign` (`project_id`),
  ADD KEY `vendor_payments_round_off_division_foreign` (`round_off_division`);

--
-- Indexes for table `vendor_payment_subs`
--
ALTER TABLE `vendor_payment_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vendor_payment_subs_payment_id_foreign` (`payment_id`);

--
-- Indexes for table `wages_creations`
--
ALTER TABLE `wages_creations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `wages_creations_division_id_foreign` (`division_id`),
  ADD KEY `wages_creations_salary_type_foreign` (`salary_type`);

--
-- Indexes for table `wages_creation_subs`
--
ALTER TABLE `wages_creation_subs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `wages_creation_subs_wages_id_foreign` (`wages_id`),
  ADD KEY `wages_creation_subs_emp_id_foreign` (`emp_id`),
  ADD KEY `wages_creation_subs_division_id_foreign` (`division_id`),
  ADD KEY `wages_creation_subs_salary_type_foreign` (`salary_type`);

--
-- Indexes for table `warehouses`
--
ALTER TABLE `warehouses`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `warehouses_name_unique` (`name`),
  ADD KEY `warehouses_division_id_foreign` (`division_id`),
  ADD KEY `warehouses_product_category_id_foreign` (`product_category_id`);

--
-- Indexes for table `workcenters`
--
ALTER TABLE `workcenters`
  ADD PRIMARY KEY (`id`),
  ADD KEY `workcenters_activity_id_foreign` (`activity_id`),
  ADD KEY `workcenters_asset_id_foreign` (`asset_id`);

--
-- Indexes for table `workcenter_standardcosts`
--
ALTER TABLE `workcenter_standardcosts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `workcenter_standardcosts_workcenter_id_foreign` (`workcenter_id`),
  ADD KEY `workcenter_standardcosts_worktype_id_foreign` (`worktype_id`);

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

--
-- Indexes for table `workorderbilldeductions`
--
ALTER TABLE `workorderbilldeductions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `workorderbilldeductions_workorderbill_id_foreign` (`workorderbill_id`);

--
-- Indexes for table `workorderbills`
--
ALTER TABLE `workorderbills`
  ADD PRIMARY KEY (`id`),
  ADD KEY `workorderbills_division_id_foreign` (`division_id`),
  ADD KEY `workorderbills_workorder_id_foreign` (`workorder_id`),
  ADD KEY `workorderbills_supplier_id_foreign` (`supplier_id`),
  ADD KEY `workorderbills_group_company_id_foreign` (`group_company_id`);

--
-- Indexes for table `workorderbillsubs`
--
ALTER TABLE `workorderbillsubs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `workorderbillsubs_workorder_id_foreign` (`workorder_id`),
  ADD KEY `workorderbillsubs_workordersub_id_foreign` (`workordersub_id`),
  ADD KEY `workorderbillsubs_main_id_foreign` (`main_id`),
  ADD KEY `workorderbillsubs_tax_id_foreign` (`tax_id`);

--
-- Indexes for table `workorderdedcutions`
--
ALTER TABLE `workorderdedcutions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `workorderdedcutions_workorder_id_foreign` (`workorder_id`);

--
-- Indexes for table `workorderlogs`
--
ALTER TABLE `workorderlogs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `workorderlogs_division_id_foreign` (`division_id`),
  ADD KEY `workorderlogs_workorder_id_foreign` (`workorder_id`),
  ADD KEY `workorderlogs_supplier_id_foreign` (`supplier_id`),
  ADD KEY `workorderlogs_production_id_foreign` (`production_id`),
  ADD KEY `workorderlogs_work_center_id_foreign` (`work_center_id`),
  ADD KEY `workorderlogs_production_log_id_foreign` (`production_log_id`),
  ADD KEY `project_id` (`project_id`);

--
-- Indexes for table `workorderlogsubs`
--
ALTER TABLE `workorderlogsubs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `workorderlogsubs_workorder_id_foreign` (`workorder_id`),
  ADD KEY `workorderlogsubs_workordersub_id_foreign` (`workordersub_id`),
  ADD KEY `workorderlogsubs_main_id_foreign` (`main_id`);

--
-- Indexes for table `workorders`
--
ALTER TABLE `workorders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `workorders_division_id_foreign` (`division_id`),
  ADD KEY `workorders_ledger_id_foreign` (`ledger_id`),
  ADD KEY `workorders_supplier_id_foreign` (`supplier_id`),
  ADD KEY `workorders_project_id_foreign` (`project_id`),
  ADD KEY `workorders_asset_id_foreign` (`asset_id`);

--
-- Indexes for table `workordersubs`
--
ALTER TABLE `workordersubs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `workordersubs_main_id_foreign` (`main_id`),
  ADD KEY `workordersubs_product_id_foreign` (`product_id`),
  ADD KEY `workordersubs_uom_id_foreign` (`uom_id`),
  ADD KEY `workordersubs_activity_id_foreign` (`activity_id`),
  ADD KEY `workordersubs_tax_id_foreign` (`tax_id`);

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

--
-- Indexes for table `work_centers`
--
ALTER TABLE `work_centers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `work_centers_division_id_foreign` (`division_id`),
  ADD KEY `work_centers_contractor_id_foreign` (`contractor_id`);

--
-- Indexes for table `work_center_cost_data`
--
ALTER TABLE `work_center_cost_data`
  ADD PRIMARY KEY (`id`),
  ADD KEY `work_center_cost_data_work_center_id_foreign` (`work_center_id`),
  ADD KEY `work_center_cost_data_cost_type_id_foreign` (`cost_type_id`);

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

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `accounts_groups`
--
ALTER TABLE `accounts_groups`
  ADD CONSTRAINT `accounts_groups_head_id_foreign` FOREIGN KEY (`head_id`) REFERENCES `accounts_heads` (`id`);

--
-- Constraints for table `accounts_ledgers`
--
ALTER TABLE `accounts_ledgers`
  ADD CONSTRAINT `accounts_ledgers_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `accounts_groups` (`id`);

--
-- Constraints for table `activitycenters`
--
ALTER TABLE `activitycenters`
  ADD CONSTRAINT `activitycenters_cost_stage_id_foreign` FOREIGN KEY (`cost_stage_id`) REFERENCES `costing_stages` (`id`),
  ADD CONSTRAINT `activitycenters_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `activitycenters_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `activity_types`
--
ALTER TABLE `activity_types`
  ADD CONSTRAINT `activity_types_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`);

--
-- Constraints for table `additiondeductionentries`
--
ALTER TABLE `additiondeductionentries`
  ADD CONSTRAINT `additiondeductionentries_additiondeduction_id_foreign` FOREIGN KEY (`additiondeduction_id`) REFERENCES `addition_deductions` (`id`),
  ADD CONSTRAINT `additiondeductionentries_canteen_id_foreign` FOREIGN KEY (`canteen_id`) REFERENCES `canteenlogs` (`id`),
  ADD CONSTRAINT `additiondeductionentries_daily_driver_update_id_foreign` FOREIGN KEY (`daily_driver_update_id`) REFERENCES `driver_daily_updates` (`id`),
  ADD CONSTRAINT `additiondeductionentries_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `additiondeductionentries_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`);

--
-- Constraints for table `addition_deductions`
--
ALTER TABLE `addition_deductions`
  ADD CONSTRAINT `addition_deductions_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `advance_entries`
--
ALTER TABLE `advance_entries`
  ADD CONSTRAINT `advance_entries_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `advance_entries_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `advance_entries_paid_group_company_id_foreign` FOREIGN KEY (`paid_group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `advance_entries_paid_ledger_id_foreign` FOREIGN KEY (`paid_ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `advance_entries_purchase_advance_id_foreign` FOREIGN KEY (`purchase_advance_id`) REFERENCES `purchase_advances` (`id`);

--
-- Constraints for table `advance_receives`
--
ALTER TABLE `advance_receives`
  ADD CONSTRAINT `advance_receives_advance_id_foreign` FOREIGN KEY (`advance_id`) REFERENCES `advance_entries` (`id`),
  ADD CONSTRAINT `advance_receives_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `advance_receives_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `advance_receives_receive_group_company_id_foreign` FOREIGN KEY (`receive_group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `advance_receives_receive_ledger_id_foreign` FOREIGN KEY (`receive_ledger_id`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `assets`
--
ALTER TABLE `assets`
  ADD CONSTRAINT `assets_asset_group_id_foreign` FOREIGN KEY (`asset_group_id`) REFERENCES `asset_groups` (`id`),
  ADD CONSTRAINT `assets_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `assets_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `assets_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `assets_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `asset_cost_centers`
--
ALTER TABLE `asset_cost_centers`
  ADD CONSTRAINT `asset_cost_centers_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `asset_cost_centers_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `asset_cost_centers_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `asset_groups`
--
ALTER TABLE `asset_groups`
  ADD CONSTRAINT `asset_groups_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `asset_categories` (`id`);

--
-- Constraints for table `bankings`
--
ALTER TABLE `bankings`
  ADD CONSTRAINT `bankings_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `bankings_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `accounts_groups` (`id`),
  ADD CONSTRAINT `bankings_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `banking_od_subs`
--
ALTER TABLE `banking_od_subs`
  ADD CONSTRAINT `banking_od_subs_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `banking_od_subs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `bankings` (`id`);

--
-- Constraints for table `bank_deposits`
--
ALTER TABLE `bank_deposits`
  ADD CONSTRAINT `bank_deposits_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `bank_deposits_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `bank_deposits_main_ledger_id_foreign` FOREIGN KEY (`main_ledger_id`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `bank_deposit_subs`
--
ALTER TABLE `bank_deposit_subs`
  ADD CONSTRAINT `bank_deposit_subs_bank_deposit_id_foreign` FOREIGN KEY (`bank_deposit_id`) REFERENCES `bank_deposits` (`id`),
  ADD CONSTRAINT `bank_deposit_subs_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `bank_transfers`
--
ALTER TABLE `bank_transfers`
  ADD CONSTRAINT `bank_transfers_from_division_id_foreign` FOREIGN KEY (`from_division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `bank_transfers_from_group_company_id_foreign` FOREIGN KEY (`from_group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `bank_transfers_from_ledger_id_foreign` FOREIGN KEY (`from_ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `bank_transfers_to_division_id_foreign` FOREIGN KEY (`to_division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `bank_transfers_to_group_company_id_foreign` FOREIGN KEY (`to_group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `bank_transfers_to_ledger_id_foreign` FOREIGN KEY (`to_ledger_id`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `branch_creations`
--
ALTER TABLE `branch_creations`
  ADD CONSTRAINT `branch_creations_headstaff_id_foreign` FOREIGN KEY (`headstaff_id`) REFERENCES `employees` (`id`);

--
-- Constraints for table `canteenlogs`
--
ALTER TABLE `canteenlogs`
  ADD CONSTRAINT `canteenlogs_contractor_id_foreign` FOREIGN KEY (`contractor_id`) REFERENCES `suppliers` (`id`),
  ADD CONSTRAINT `canteenlogs_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`);

--
-- Constraints for table `canteenlogsubs`
--
ALTER TABLE `canteenlogsubs`
  ADD CONSTRAINT `canteenlogsubs_contractor_id_foreign` FOREIGN KEY (`contractor_id`) REFERENCES `suppliers` (`id`),
  ADD CONSTRAINT `canteenlogsubs_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `canteenlogsubs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `canteenlogs` (`id`);

--
-- Constraints for table `canteenmealrates`
--
ALTER TABLE `canteenmealrates`
  ADD CONSTRAINT `canteenmealrates_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `collectionforms`
--
ALTER TABLE `collectionforms`
  ADD CONSTRAINT `collectionforms_bank_ledger_id_foreign` FOREIGN KEY (`bank_ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `collectionforms_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branch_creations` (`id`),
  ADD CONSTRAINT `collectionforms_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `collectionforms_excess_amount_division_foreign` FOREIGN KEY (`excess_amount_division`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `collectionforms_excessamount_groupcompany_id_foreign` FOREIGN KEY (`excessamount_groupcompany_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `collectionforms_executive_id_foreign` FOREIGN KEY (`executive_id`) REFERENCES `staffbranches` (`id`),
  ADD CONSTRAINT `collectionforms_round_off_division_foreign` FOREIGN KEY (`round_off_division`) REFERENCES `divisions` (`id`);

--
-- Constraints for table `collectionform_subs`
--
ALTER TABLE `collectionform_subs`
  ADD CONSTRAINT `collectionform_subs_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `collectionform_subs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `collectionforms` (`id`);

--
-- Constraints for table `collection_followups`
--
ALTER TABLE `collection_followups`
  ADD CONSTRAINT `collection_followups_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branch_creations` (`id`),
  ADD CONSTRAINT `collection_followups_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `collection_followups_executive_id_foreign` FOREIGN KEY (`executive_id`) REFERENCES `staffbranches` (`id`);

--
-- Constraints for table `collection_followup_histories`
--
ALTER TABLE `collection_followup_histories`
  ADD CONSTRAINT `collection_followup_histories_follow_comment_id_foreign` FOREIGN KEY (`follow_comment_id`) REFERENCES `collection_followup_comments` (`id`),
  ADD CONSTRAINT `collection_followup_histories_followup_id_foreign` FOREIGN KEY (`followup_id`) REFERENCES `collection_followups` (`id`),
  ADD CONSTRAINT `collection_followup_histories_history_id_foreign` FOREIGN KEY (`history_id`) REFERENCES `collection_followup_histories` (`id`);

--
-- Constraints for table `collection_projections`
--
ALTER TABLE `collection_projections`
  ADD CONSTRAINT `collection_projections_executive_id_foreign` FOREIGN KEY (`executive_id`) REFERENCES `staffbranches` (`id`);

--
-- Constraints for table `collection_projection_subs`
--
ALTER TABLE `collection_projection_subs`
  ADD CONSTRAINT `collection_projection_subs_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `collection_projection_subs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `collection_projections` (`id`);

--
-- Constraints for table `company_addresses`
--
ALTER TABLE `company_addresses`
  ADD CONSTRAINT `company_addresses_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`);

--
-- Constraints for table `contract_logs`
--
ALTER TABLE `contract_logs`
  ADD CONSTRAINT `contract_logs_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `contract_logs_salary_type_foreign` FOREIGN KEY (`salary_type`) REFERENCES `salary_types` (`id`);

--
-- Constraints for table `contract_log_subs`
--
ALTER TABLE `contract_log_subs`
  ADD CONSTRAINT `contract_log_subs_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `contract_log_subs_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `contract_log_subs_log_id_foreign` FOREIGN KEY (`log_id`) REFERENCES `contract_logs` (`id`),
  ADD CONSTRAINT `contract_log_subs_product_cost_id_foreign` FOREIGN KEY (`product_cost_id`) REFERENCES `contract_prouct_costs` (`id`),
  ADD CONSTRAINT `contract_log_subs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `contract_log_subs_salary_type_foreign` FOREIGN KEY (`salary_type`) REFERENCES `salary_types` (`id`);

--
-- Constraints for table `contract_prouct_costs`
--
ALTER TABLE `contract_prouct_costs`
  ADD CONSTRAINT `contract_prouct_costs_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `contract_prouct_costs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `contract_prouct_costs_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `costing_stages`
--
ALTER TABLE `costing_stages`
  ADD CONSTRAINT `costing_stages_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`);

--
-- Constraints for table `cost_centers`
--
ALTER TABLE `cost_centers`
  ADD CONSTRAINT `cost_centers_cost_center_id_foreign` FOREIGN KEY (`cost_center_id`) REFERENCES `designations` (`id`),
  ADD CONSTRAINT `cost_centers_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`);

--
-- Constraints for table `creditnotes`
--
ALTER TABLE `creditnotes`
  ADD CONSTRAINT `creditnotes_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branch_creations` (`id`),
  ADD CONSTRAINT `creditnotes_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `creditnotes_discount_id_foreign` FOREIGN KEY (`discount_id`) REFERENCES `salesdiscounts` (`id`),
  ADD CONSTRAINT `creditnotes_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `creditnotes_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `creditnotes_salesorder_id_foreign` FOREIGN KEY (`salesorder_id`) REFERENCES `salesorders` (`id`),
  ADD CONSTRAINT `creditnotes_salesperson_id_foreign` FOREIGN KEY (`salesperson_id`) REFERENCES `staffbranches` (`id`),
  ADD CONSTRAINT `creditnotes_salesreturn_id_foreign` FOREIGN KEY (`salesreturn_id`) REFERENCES `salesreturns` (`id`);

--
-- Constraints for table `creditnotesubs`
--
ALTER TABLE `creditnotesubs`
  ADD CONSTRAINT `creditnotesubs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `creditnotes` (`id`),
  ADD CONSTRAINT `creditnotesubs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `creditnotesubs_sales_return_subid_foreign` FOREIGN KEY (`sales_return_subid`) REFERENCES `salesreturnsubs` (`id`),
  ADD CONSTRAINT `creditnotesubs_salesorder_subid_foreign` FOREIGN KEY (`salesorder_subid`) REFERENCES `salesorder_subs` (`id`),
  ADD CONSTRAINT `creditnotesubs_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`id`);

--
-- Constraints for table `customeraddresses`
--
ALTER TABLE `customeraddresses`
  ADD CONSTRAINT `customeraddresses_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`);

--
-- Constraints for table `customeropeningbalances`
--
ALTER TABLE `customeropeningbalances`
  ADD CONSTRAINT `customeropeningbalances_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branch_creations` (`id`),
  ADD CONSTRAINT `customeropeningbalances_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `customeropeningbalances_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `customeropeningbalances_salesperson_id_foreign` FOREIGN KEY (`salesperson_id`) REFERENCES `staffbranches` (`id`);

--
-- Constraints for table `customerpos`
--
ALTER TABLE `customerpos`
  ADD CONSTRAINT `customerpos_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `customerpos_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`);

--
-- Constraints for table `customerposubs`
--
ALTER TABLE `customerposubs`
  ADD CONSTRAINT `customerposubs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `customerpos` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `customerposubs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `customerposubs_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`id`);

--
-- Constraints for table `customerresponsibilities`
--
ALTER TABLE `customerresponsibilities`
  ADD CONSTRAINT `customerresponsibilities_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`);

--
-- Constraints for table `customers`
--
ALTER TABLE `customers`
  ADD CONSTRAINT `customers_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branch_creations` (`id`),
  ADD CONSTRAINT `customers_emp_responsibility_id_foreign` FOREIGN KEY (`emp_responsibility_id`) REFERENCES `customerresponsibilities` (`id`),
  ADD CONSTRAINT `customers_payterms_id_foreign` FOREIGN KEY (`payterms_id`) REFERENCES `paymentterms` (`id`);

--
-- Constraints for table `customer_bills`
--
ALTER TABLE `customer_bills`
  ADD CONSTRAINT `customer_bills_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branch_creations` (`id`),
  ADD CONSTRAINT `customer_bills_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `customer_bills_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `customer_bills_groupcompany_id_foreign` FOREIGN KEY (`groupcompany_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `customer_bills_salesperson_id_foreign` FOREIGN KEY (`salesperson_id`) REFERENCES `staffbranches` (`id`);

--
-- Constraints for table `customer_transactions`
--
ALTER TABLE `customer_transactions`
  ADD CONSTRAINT `customer_transactions_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branch_creations` (`id`),
  ADD CONSTRAINT `customer_transactions_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `customer_transactions_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `customer_transactions_groupcompany_id_foreign` FOREIGN KEY (`groupcompany_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `customer_transactions_salesperson_id_foreign` FOREIGN KEY (`salesperson_id`) REFERENCES `staffbranches` (`id`);

--
-- Constraints for table `designation_wages_subs`
--
ALTER TABLE `designation_wages_subs`
  ADD CONSTRAINT `designation_wages_subs_designation_id_foreign` FOREIGN KEY (`designation_id`) REFERENCES `designations` (`id`),
  ADD CONSTRAINT `designation_wages_subs_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`);

--
-- Constraints for table `dieselissues`
--
ALTER TABLE `dieselissues`
  ADD CONSTRAINT `dieselissues_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `dieselissues_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `dieselissues_subs`
--
ALTER TABLE `dieselissues_subs`
  ADD CONSTRAINT `dieselissues_subs_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `dieselissues_subs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `dieselissues` (`id`),
  ADD CONSTRAINT `dieselissues_subs_workorder_id_foreign` FOREIGN KEY (`workorder_id`) REFERENCES `workorders` (`id`);

--
-- Constraints for table `divisions`
--
ALTER TABLE `divisions`
  ADD CONSTRAINT `divisions_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `division_dispatch_costs`
--
ALTER TABLE `division_dispatch_costs`
  ADD CONSTRAINT `division_dispatch_costs_dispatch_vehicles_id_foreign` FOREIGN KEY (`dispatch_vehicles_id`) REFERENCES `division_dispatch_vehicles` (`id`);

--
-- Constraints for table `division_dispatch_vehicles`
--
ALTER TABLE `division_dispatch_vehicles`
  ADD CONSTRAINT `division_dispatch_vehicles_asset_group_id_foreign` FOREIGN KEY (`asset_group_id`) REFERENCES `asset_groups` (`id`),
  ADD CONSTRAINT `division_dispatch_vehicles_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`);

--
-- Constraints for table `driver_daily_updates`
--
ALTER TABLE `driver_daily_updates`
  ADD CONSTRAINT `driver_daily_updates_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `driver_daily_updates_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shiftcreations` (`id`);

--
-- Constraints for table `driver_daily_updates_subs`
--
ALTER TABLE `driver_daily_updates_subs`
  ADD CONSTRAINT `driver_daily_updates_subs_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `driver_daily_updates_subs_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `driver_daily_updates_subs_main_log_id_foreign` FOREIGN KEY (`main_log_id`) REFERENCES `driver_daily_updates` (`id`),
  ADD CONSTRAINT `driver_daily_updates_subs_salary_type_foreign` FOREIGN KEY (`salary_type`) REFERENCES `salary_types` (`id`),
  ADD CONSTRAINT `driver_daily_updates_subs_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shiftcreations` (`id`);

--
-- Constraints for table `eb_meter_masters`
--
ALTER TABLE `eb_meter_masters`
  ADD CONSTRAINT `eb_meter_masters_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`);

--
-- Constraints for table `employees`
--
ALTER TABLE `employees`
  ADD CONSTRAINT `employees_designation_id_foreign` FOREIGN KEY (`designation_id`) REFERENCES `designations` (`id`),
  ADD CONSTRAINT `employees_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `employees_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `employees_salary_type_foreign` FOREIGN KEY (`salary_type`) REFERENCES `salary_types` (`id`);

--
-- Constraints for table `employee_biometrics`
--
ALTER TABLE `employee_biometrics`
  ADD CONSTRAINT `employee_biometrics_empcode_foreign` FOREIGN KEY (`Empcode`) REFERENCES `employees` (`id`);

--
-- Constraints for table `employee_documents`
--
ALTER TABLE `employee_documents`
  ADD CONSTRAINT `employee_documents_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`);

--
-- Constraints for table `employee_earnings`
--
ALTER TABLE `employee_earnings`
  ADD CONSTRAINT `employee_earnings_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `employee_earnings_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `employee_earnings_main_division_id_foreign` FOREIGN KEY (`main_division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `employee_earnings_salary_type_foreign` FOREIGN KEY (`salary_type`) REFERENCES `salary_types` (`id`);

--
-- Constraints for table `employee_education_subs`
--
ALTER TABLE `employee_education_subs`
  ADD CONSTRAINT `employee_education_subs_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`);

--
-- Constraints for table `employee_experience_subs`
--
ALTER TABLE `employee_experience_subs`
  ADD CONSTRAINT `employee_experience_subs_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`);

--
-- Constraints for table `employee_salaries`
--
ALTER TABLE `employee_salaries`
  ADD CONSTRAINT `employee_salaries_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `employee_staff_salaries`
--
ALTER TABLE `employee_staff_salaries`
  ADD CONSTRAINT `employee_staff_salaries_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`);

--
-- Constraints for table `employee_transactions`
--
ALTER TABLE `employee_transactions`
  ADD CONSTRAINT `employee_transactions_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `employee_transactions_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`);

--
-- Constraints for table `estimationforms`
--
ALTER TABLE `estimationforms`
  ADD CONSTRAINT `estimationforms_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branch_creations` (`id`),
  ADD CONSTRAINT `estimationforms_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `estimationforms_deliverysite_id_foreign` FOREIGN KEY (`deliverysite_id`) REFERENCES `customeraddresses` (`id`),
  ADD CONSTRAINT `estimationforms_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `estimationforms_paymentterm_id_foreign` FOREIGN KEY (`paymentterm_id`) REFERENCES `paymentterms` (`id`),
  ADD CONSTRAINT `estimationforms_po_id_foreign` FOREIGN KEY (`po_id`) REFERENCES `customerpos` (`id`),
  ADD CONSTRAINT `estimationforms_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `projectcreations` (`id`),
  ADD CONSTRAINT `estimationforms_salesorder_id_foreign` FOREIGN KEY (`salesorder_id`) REFERENCES `salesorders` (`id`),
  ADD CONSTRAINT `estimationforms_salesperson_id_foreign` FOREIGN KEY (`salesperson_id`) REFERENCES `staffbranches` (`id`),
  ADD CONSTRAINT `estimationforms_unloading_type_id_foreign` FOREIGN KEY (`unloading_type_id`) REFERENCES `loading_types` (`id`);

--
-- Constraints for table `estimationformsubs`
--
ALTER TABLE `estimationformsubs`
  ADD CONSTRAINT `estimationformsubs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `estimationforms` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `estimationformsubs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `estimationformsubs_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`id`),
  ADD CONSTRAINT `estimationformsubs_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `expense_types`
--
ALTER TABLE `expense_types`
  ADD CONSTRAINT `expense_types_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `expense_vouchers`
--
ALTER TABLE `expense_vouchers`
  ADD CONSTRAINT `expense_vouchers_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `expense_vouchers_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `expense_vouchers_group_company_foreign` FOREIGN KEY (`group_company`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `expense_vouchers_instructed_by_foreign` FOREIGN KEY (`instructed_by`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `expense_vouchers_issued_by_foreign` FOREIGN KEY (`issued_by`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `expense_vouchers_paid_id_foreign` FOREIGN KEY (`paid_id`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `expense_voucher_subs`
--
ALTER TABLE `expense_voucher_subs`
  ADD CONSTRAINT `expense_voucher_subs_expense_type_foreign` FOREIGN KEY (`expense_type`) REFERENCES `expense_types` (`id`),
  ADD CONSTRAINT `expense_voucher_subs_expense_voucher_id_foreign` FOREIGN KEY (`expense_voucher_id`) REFERENCES `expense_vouchers` (`id`);

--
-- Constraints for table `fund_transfers`
--
ALTER TABLE `fund_transfers`
  ADD CONSTRAINT `fund_transfers_cash_bank_ledger_id_foreign` FOREIGN KEY (`cash_bank_ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `fund_transfers_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `fund_transfers_receive_division_foreign` FOREIGN KEY (`receive_division`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `fund_transfers_transfer_division_foreign` FOREIGN KEY (`transfer_division`) REFERENCES `divisions` (`id`);

--
-- Constraints for table `gate_entries`
--
ALTER TABLE `gate_entries`
  ADD CONSTRAINT `gate_entries_driver_id_foreign` FOREIGN KEY (`driver_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `gate_entries_manual_trip_id_foreign` FOREIGN KEY (`manual_trip_id`) REFERENCES `manual_trip_sheets` (`id`),
  ADD CONSTRAINT `gate_entries_purchaseorder_id_foreign` FOREIGN KEY (`purchaseorder_id`) REFERENCES `purchase_orders` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `gate_entries_trip_id_foreign` FOREIGN KEY (`trip_id`) REFERENCES `inter_trip_masters` (`id`);

--
-- Constraints for table `gate_passes`
--
ALTER TABLE `gate_passes`
  ADD CONSTRAINT `gate_passes_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `gate_passes_request_by_foreign` FOREIGN KEY (`request_by`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `gate_passes_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `assets` (`id`);

--
-- Constraints for table `gate_pass_ins`
--
ALTER TABLE `gate_pass_ins`
  ADD CONSTRAINT `gate_pass_ins_gate_pass_id_foreign` FOREIGN KEY (`gate_pass_id`) REFERENCES `gate_passes` (`id`),
  ADD CONSTRAINT `gate_pass_ins_received_by_foreign` FOREIGN KEY (`received_by`) REFERENCES `employees` (`id`);

--
-- Constraints for table `gate_pass_in_subs`
--
ALTER TABLE `gate_pass_in_subs`
  ADD CONSTRAINT `gate_pass_in_subs_gate_in_id_foreign` FOREIGN KEY (`gate_in_id`) REFERENCES `gate_pass_ins` (`id`),
  ADD CONSTRAINT `gate_pass_in_subs_gate_pass_id_foreign` FOREIGN KEY (`gate_pass_id`) REFERENCES `gate_passes` (`id`),
  ADD CONSTRAINT `gate_pass_in_subs_gate_pass_sub_id_foreign` FOREIGN KEY (`gate_pass_sub_id`) REFERENCES `gate_pass_subs` (`id`);

--
-- Constraints for table `gate_pass_subs`
--
ALTER TABLE `gate_pass_subs`
  ADD CONSTRAINT `gate_pass_subs_gate_pass_id_foreign` FOREIGN KEY (`gate_pass_id`) REFERENCES `gate_passes` (`id`),
  ADD CONSTRAINT `gate_pass_subs_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `grns`
--
ALTER TABLE `grns`
  ADD CONSTRAINT `grns_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `grns_gate_id_foreign` FOREIGN KEY (`gate_id`) REFERENCES `gate_entries` (`id`),
  ADD CONSTRAINT `grns_manual_trip_id_foreign` FOREIGN KEY (`manual_trip_id`) REFERENCES `manual_trip_sheets` (`id`),
  ADD CONSTRAINT `grns_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `purchase_orders` (`id`);

--
-- Constraints for table `grn_bills`
--
ALTER TABLE `grn_bills`
  ADD CONSTRAINT `grn_bills_billing_address_id_foreign` FOREIGN KEY (`billing_address_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `grn_bills_delivery_id_foreign` FOREIGN KEY (`delivery_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `grn_bills_grn_id_foreign` FOREIGN KEY (`grn_id`) REFERENCES `grns` (`id`),
  ADD CONSTRAINT `grn_bills_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `grn_bills_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `purchase_orders` (`id`),
  ADD CONSTRAINT `grn_bills_other_id_foreign` FOREIGN KEY (`other_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `grn_bills_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`),
  ADD CONSTRAINT `grn_bills_tds_id_foreign` FOREIGN KEY (`tds_id`) REFERENCES `tds` (`id`),
  ADD CONSTRAINT `grn_bills_tds_ledger_foreign` FOREIGN KEY (`tds_ledger`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `grn_bill_subs`
--
ALTER TABLE `grn_bill_subs`
  ADD CONSTRAINT `grn_bill_subs_asset_ledger_id_foreign` FOREIGN KEY (`asset_ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `grn_bill_subs_grn_bill_id_foreign` FOREIGN KEY (`grn_bill_id`) REFERENCES `grn_bills` (`id`),
  ADD CONSTRAINT `grn_bill_subs_grn_id_foreign` FOREIGN KEY (`grn_id`) REFERENCES `grns` (`id`),
  ADD CONSTRAINT `grn_bill_subs_grn_sub_id_foreign` FOREIGN KEY (`grn_sub_id`) REFERENCES `grn_subs` (`id`),
  ADD CONSTRAINT `grn_bill_subs_hsn_id_foreign` FOREIGN KEY (`hsn_id`) REFERENCES `hsns` (`id`),
  ADD CONSTRAINT `grn_bill_subs_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `purchase_orders` (`id`),
  ADD CONSTRAINT `grn_bill_subs_order_sub_id_foreign` FOREIGN KEY (`order_sub_id`) REFERENCES `purchase_order_subs` (`id`),
  ADD CONSTRAINT `grn_bill_subs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`);

--
-- Constraints for table `grn_subs`
--
ALTER TABLE `grn_subs`
  ADD CONSTRAINT `grn_subs_brand_name_foreign` FOREIGN KEY (`brand_name`) REFERENCES `product_vendors_subs` (`id`),
  ADD CONSTRAINT `grn_subs_grn_id_foreign` FOREIGN KEY (`grn_id`) REFERENCES `grns` (`id`),
  ADD CONSTRAINT `grn_subs_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `purchase_orders` (`id`),
  ADD CONSTRAINT `grn_subs_order_sub_id_foreign` FOREIGN KEY (`order_sub_id`) REFERENCES `purchase_order_subs` (`id`),
  ADD CONSTRAINT `grn_subs_reject_reason_id_foreign` FOREIGN KEY (`reject_reason_id`) REFERENCES `grn_reject_reasons` (`id`),
  ADD CONSTRAINT `grn_subs_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `groupcompanies`
--
ALTER TABLE `groupcompanies`
  ADD CONSTRAINT `groupcompanies_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`);

--
-- Constraints for table `hsns`
--
ALTER TABLE `hsns`
  ADD CONSTRAINT `hsns_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`id`);

--
-- Constraints for table `intercompanyfreights`
--
ALTER TABLE `intercompanyfreights`
  ADD CONSTRAINT `intercompanyfreights_asset_group_id_foreign` FOREIGN KEY (`asset_group_id`) REFERENCES `asset_groups` (`id`),
  ADD CONSTRAINT `intercompanyfreights_purchase_division_id_foreign` FOREIGN KEY (`purchase_division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `intercompanyfreights_sales_division_id_foreign` FOREIGN KEY (`sales_division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `intercompanyfreights_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `intercompanyfreighttrackings`
--
ALTER TABLE `intercompanyfreighttrackings`
  ADD CONSTRAINT `intercompanyfreighttrackings_intercompanyfreight_id_foreign` FOREIGN KEY (`intercompanyfreight_id`) REFERENCES `intercompanyfreights` (`id`);

--
-- Constraints for table `inter_company_inwards`
--
ALTER TABLE `inter_company_inwards`
  ADD CONSTRAINT `inter_company_inwards_deliver_group_company_id_foreign` FOREIGN KEY (`deliver_group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `inter_company_inwards_deliver_to_foreign` FOREIGN KEY (`deliver_to`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `inter_company_inwards_purchase_from_foreign` FOREIGN KEY (`purchase_from`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `inter_company_inwards_purchase_group_company_id_foreign` FOREIGN KEY (`purchase_group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `inter_company_inwards_purchase_id_foreign` FOREIGN KEY (`purchase_id`) REFERENCES `inter_purchase_requests` (`id`),
  ADD CONSTRAINT `inter_company_inwards_purchase_product_id_foreign` FOREIGN KEY (`purchase_product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `inter_company_inwards_sale_product_id_foreign` FOREIGN KEY (`sale_product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `inter_company_inwards_sales_id_foreign` FOREIGN KEY (`sales_id`) REFERENCES `inter_sales_orders` (`id`),
  ADD CONSTRAINT `inter_company_inwards_trip_id_foreign` FOREIGN KEY (`trip_id`) REFERENCES `inter_sales_trips` (`id`),
  ADD CONSTRAINT `inter_company_inwards_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`),
  ADD CONSTRAINT `inter_company_inwards_warehouse_id_from_foreign` FOREIGN KEY (`warehouse_id_from`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `inter_company_loadings`
--
ALTER TABLE `inter_company_loadings`
  ADD CONSTRAINT `inter_company_loadings_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `inter_company_loadings_deliver_to_foreign` FOREIGN KEY (`deliver_to`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `inter_company_loadings_purchase_from_foreign` FOREIGN KEY (`purchase_from`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `inter_company_loadings_trip_id_foreign` FOREIGN KEY (`trip_id`) REFERENCES `inter_sales_trips` (`id`);

--
-- Constraints for table `inter_company_weighments`
--
ALTER TABLE `inter_company_weighments`
  ADD CONSTRAINT `inter_company_weighments_trip_id_foreign` FOREIGN KEY (`trip_id`) REFERENCES `inter_sales_trips` (`id`);

--
-- Constraints for table `inter_purchase_requests`
--
ALTER TABLE `inter_purchase_requests`
  ADD CONSTRAINT `inter_purchase_requests_deliver_to_foreign` FOREIGN KEY (`deliver_to`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `inter_purchase_requests_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `inter_purchase_requests_purchase_from_foreign` FOREIGN KEY (`purchase_from`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `inter_purchase_requests_purchase_req_id_foreign` FOREIGN KEY (`purchase_req_id`) REFERENCES `purchase_requests` (`id`);

--
-- Constraints for table `inter_sales_orders`
--
ALTER TABLE `inter_sales_orders`
  ADD CONSTRAINT `inter_sales_orders_deliver_to_foreign` FOREIGN KEY (`deliver_to`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `inter_sales_orders_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `inter_sales_orders_purchase_from_foreign` FOREIGN KEY (`purchase_from`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `inter_sales_orders_request_id_foreign` FOREIGN KEY (`request_id`) REFERENCES `inter_purchase_requests` (`id`);

--
-- Constraints for table `inter_sales_trackings`
--
ALTER TABLE `inter_sales_trackings`
  ADD CONSTRAINT `inter_sales_trackings_trip_id_foreign` FOREIGN KEY (`trip_id`) REFERENCES `inter_sales_trips` (`id`);

--
-- Constraints for table `inter_sales_trips`
--
ALTER TABLE `inter_sales_trips`
  ADD CONSTRAINT `inter_sales_trips_assign_truck_id_foreign` FOREIGN KEY (`assign_truck_id`) REFERENCES `truckassigns` (`id`),
  ADD CONSTRAINT `inter_sales_trips_deliver_group_company_id_foreign` FOREIGN KEY (`deliver_group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `inter_sales_trips_deliver_to_foreign` FOREIGN KEY (`deliver_to`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `inter_sales_trips_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `inter_sales_trips_purchase_from_foreign` FOREIGN KEY (`purchase_from`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `inter_sales_trips_purchase_group_company_id_foreign` FOREIGN KEY (`purchase_group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `inter_sales_trips_sales_id_foreign` FOREIGN KEY (`sales_id`) REFERENCES `inter_sales_orders` (`id`),
  ADD CONSTRAINT `inter_sales_trips_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shiftcreations` (`id`),
  ADD CONSTRAINT `inter_sales_trips_trip_id_foreign` FOREIGN KEY (`trip_id`) REFERENCES `inter_trip_masters` (`id`),
  ADD CONSTRAINT `inter_sales_trips_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`),
  ADD CONSTRAINT `inter_sales_trips_warehouse_id_to_foreign` FOREIGN KEY (`warehouse_id_to`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `inwardcheques`
--
ALTER TABLE `inwardcheques`
  ADD CONSTRAINT `inwardcheques_bank_ledger_id_foreign` FOREIGN KEY (`bank_ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `inwardcheques_collection_id_foreign` FOREIGN KEY (`collection_id`) REFERENCES `collectionforms` (`id`),
  ADD CONSTRAINT `inwardcheques_depositebank_id_foreign` FOREIGN KEY (`depositebank_id`) REFERENCES `bankings` (`id`),
  ADD CONSTRAINT `inwardcheques_return_reason_foreign` FOREIGN KEY (`return_reason`) REFERENCES `chequereturnreasons` (`id`);

--
-- Constraints for table `job_cards`
--
ALTER TABLE `job_cards`
  ADD CONSTRAINT `job_cards_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `job_cards_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `job_cards_work_reason_id_foreign` FOREIGN KEY (`work_reason_id`) REFERENCES `work_reasons` (`id`);

--
-- Constraints for table `job_card_daily_actions`
--
ALTER TABLE `job_card_daily_actions`
  ADD CONSTRAINT `job_card_daily_actions_job_id_foreign` FOREIGN KEY (`job_id`) REFERENCES `job_cards` (`id`);

--
-- Constraints for table `journal_vouchers`
--
ALTER TABLE `journal_vouchers`
  ADD CONSTRAINT `journal_vouchers_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `journal_vouchers_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`);

--
-- Constraints for table `journal_voucher_subs`
--
ALTER TABLE `journal_voucher_subs`
  ADD CONSTRAINT `journal_voucher_subs_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `journal_voucher_subs_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `journal_voucher_subs_journal_voucher_id_foreign` FOREIGN KEY (`journal_voucher_id`) REFERENCES `journal_vouchers` (`id`),
  ADD CONSTRAINT `journal_voucher_subs_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `journal_voucher_subs_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `kmhraudits`
--
ALTER TABLE `kmhraudits`
  ADD CONSTRAINT `kmhraudits_audited_by_foreign` FOREIGN KEY (`audited_by`) REFERENCES `employees` (`id`);

--
-- Constraints for table `kmhraudit_subs`
--
ALTER TABLE `kmhraudit_subs`
  ADD CONSTRAINT `kmhraudit_subs_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `kmhraudit_subs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `kmhraudits` (`id`);

--
-- Constraints for table `leave_entries`
--
ALTER TABLE `leave_entries`
  ADD CONSTRAINT `leave_entries_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `leave_entries_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `leave_entries_leave_type_foreign` FOREIGN KEY (`leave_type`) REFERENCES `leavetypes` (`id`),
  ADD CONSTRAINT `leave_entries_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shiftcreations` (`id`);

--
-- Constraints for table `ledger_transactions`
--
ALTER TABLE `ledger_transactions`
  ADD CONSTRAINT `ledger_transactions_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `ledger_transactions_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `ledger_transactions_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `loading_types`
--
ALTER TABLE `loading_types`
  ADD CONSTRAINT `loading_types_asset_group_foreign` FOREIGN KEY (`asset_group`) REFERENCES `asset_groups` (`id`),
  ADD CONSTRAINT `loading_types_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `loading_types_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `loading_type_costs`
--
ALTER TABLE `loading_type_costs`
  ADD CONSTRAINT `loading_type_costs_loading_type_id_foreign` FOREIGN KEY (`loading_type_id`) REFERENCES `loading_types` (`id`),
  ADD CONSTRAINT `loading_type_costs_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `machineryassigns`
--
ALTER TABLE `machineryassigns`
  ADD CONSTRAINT `machineryassigns_driver_id_foreign` FOREIGN KEY (`driver_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `machineryassigns_job_card_id_foreign` FOREIGN KEY (`job_card_id`) REFERENCES `job_cards` (`id`),
  ADD CONSTRAINT `machineryassigns_machinery_id_foreign` FOREIGN KEY (`machinery_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `machineryassigns_parked_site_id_foreign` FOREIGN KEY (`parked_site_id`) REFERENCES `parked_sites` (`id`),
  ADD CONSTRAINT `machineryassigns_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shiftcreations` (`id`);

--
-- Constraints for table `machinery_logs`
--
ALTER TABLE `machinery_logs`
  ADD CONSTRAINT `machinery_logs_machinery_id_foreign` FOREIGN KEY (`machinery_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `machinery_logs_operator_id_foreign` FOREIGN KEY (`operator_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `machinery_logs_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shiftcreations` (`id`);

--
-- Constraints for table `machinery_log_subs`
--
ALTER TABLE `machinery_log_subs`
  ADD CONSTRAINT `machinery_log_subs_activity_type_foreign` FOREIGN KEY (`activity_type`) REFERENCES `activity_types` (`id`),
  ADD CONSTRAINT `machinery_log_subs_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `machinery_log_subs_machinery_log_id_foreign` FOREIGN KEY (`machinery_log_id`) REFERENCES `machinery_logs` (`id`);

--
-- Constraints for table `machine_activity_logs`
--
ALTER TABLE `machine_activity_logs`
  ADD CONSTRAINT `machine_activity_logs_activity_type_foreign` FOREIGN KEY (`activity_type`) REFERENCES `loading_types` (`id`),
  ADD CONSTRAINT `machine_activity_logs_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `machine_activity_logs_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `machine_activity_logs_delivery_site_id_foreign` FOREIGN KEY (`delivery_site_id`) REFERENCES `customeraddresses` (`id`),
  ADD CONSTRAINT `machine_activity_logs_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`);

--
-- Constraints for table `machine_activity_log_dcs`
--
ALTER TABLE `machine_activity_log_dcs`
  ADD CONSTRAINT `machine_activity_log_dcs_log_main_id_foreign` FOREIGN KEY (`log_main_id`) REFERENCES `machine_activity_logs` (`id`),
  ADD CONSTRAINT `machine_activity_log_dcs_sales_dc_id_foreign` FOREIGN KEY (`sales_dc_id`) REFERENCES `sales_dcs` (`id`);

--
-- Constraints for table `machine_centers`
--
ALTER TABLE `machine_centers`
  ADD CONSTRAINT `machine_centers_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `machine_centers_work_center_id_foreign` FOREIGN KEY (`work_center_id`) REFERENCES `work_centers` (`id`);

--
-- Constraints for table `machine_center_costs`
--
ALTER TABLE `machine_center_costs`
  ADD CONSTRAINT `machine_center_costs_cost_type_id_foreign` FOREIGN KEY (`cost_type_id`) REFERENCES `work_center_cost_types` (`id`),
  ADD CONSTRAINT `machine_center_costs_machine_center_id_foreign` FOREIGN KEY (`machine_center_id`) REFERENCES `machine_centers` (`id`);

--
-- Constraints for table `manual_attendances`
--
ALTER TABLE `manual_attendances`
  ADD CONSTRAINT `manual_attendances_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `manual_attendances_salary_type_foreign` FOREIGN KEY (`salary_type`) REFERENCES `salary_types` (`id`),
  ADD CONSTRAINT `manual_attendances_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shiftcreations` (`id`);

--
-- Constraints for table `manual_attendance_subs`
--
ALTER TABLE `manual_attendance_subs`
  ADD CONSTRAINT `manual_attendance_subs_attendance_id_foreign` FOREIGN KEY (`attendance_id`) REFERENCES `manual_attendances` (`id`),
  ADD CONSTRAINT `manual_attendance_subs_design_wages_id_foreign` FOREIGN KEY (`design_wages_id`) REFERENCES `designation_wages_subs` (`id`),
  ADD CONSTRAINT `manual_attendance_subs_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `manual_attendance_subs_main_division_id_foreign` FOREIGN KEY (`main_division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `manual_attendance_subs_salary_type_foreign` FOREIGN KEY (`salary_type`) REFERENCES `salary_types` (`id`),
  ADD CONSTRAINT `manual_attendance_subs_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shiftcreations` (`id`),
  ADD CONSTRAINT `manual_attendance_subs_sub_division_id_foreign` FOREIGN KEY (`sub_division_id`) REFERENCES `divisions` (`id`);

--
-- Constraints for table `manual_trip_sheets`
--
ALTER TABLE `manual_trip_sheets`
  ADD CONSTRAINT `manual_trip_sheets_driver_id_foreign` FOREIGN KEY (`driver_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `manual_trip_sheets_po_id_foreign` FOREIGN KEY (`po_id`) REFERENCES `purchase_orders` (`id`),
  ADD CONSTRAINT `manual_trip_sheets_trip_id_foreign` FOREIGN KEY (`trip_id`) REFERENCES `inter_trip_masters` (`id`),
  ADD CONSTRAINT `manual_trip_sheets_truck_id_foreign` FOREIGN KEY (`truck_id`) REFERENCES `assets` (`id`);

--
-- Constraints for table `material_issues`
--
ALTER TABLE `material_issues`
  ADD CONSTRAINT `material_issues_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `material_issues_received_by_foreign` FOREIGN KEY (`received_by`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `material_issues_request_id_foreign` FOREIGN KEY (`request_id`) REFERENCES `material_requests` (`id`);

--
-- Constraints for table `material_issue_returns`
--
ALTER TABLE `material_issue_returns`
  ADD CONSTRAINT `material_issue_returns_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `material_issue_returns_issue_id_foreign` FOREIGN KEY (`issue_id`) REFERENCES `material_issues` (`id`),
  ADD CONSTRAINT `material_issue_returns_returned_by_foreign` FOREIGN KEY (`returned_by`) REFERENCES `employees` (`id`);

--
-- Constraints for table `material_issue_return_subs`
--
ALTER TABLE `material_issue_return_subs`
  ADD CONSTRAINT `material_issue_return_subs_issue_id_foreign` FOREIGN KEY (`issue_id`) REFERENCES `material_issues` (`id`),
  ADD CONSTRAINT `material_issue_return_subs_issue_sub_id_foreign` FOREIGN KEY (`issue_sub_id`) REFERENCES `material_issue_subs` (`id`),
  ADD CONSTRAINT `material_issue_return_subs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `material_issue_return_subs_return_id_foreign` FOREIGN KEY (`return_id`) REFERENCES `material_requests` (`id`),
  ADD CONSTRAINT `material_issue_return_subs_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `material_issue_subs`
--
ALTER TABLE `material_issue_subs`
  ADD CONSTRAINT `material_issue_subs_issue_id_foreign` FOREIGN KEY (`issue_id`) REFERENCES `material_issues` (`id`),
  ADD CONSTRAINT `material_issue_subs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `material_issue_subs_request_id_foreign` FOREIGN KEY (`request_id`) REFERENCES `material_requests` (`id`),
  ADD CONSTRAINT `material_issue_subs_request_sub_id_foreign` FOREIGN KEY (`request_sub_id`) REFERENCES `material_request_subs` (`id`),
  ADD CONSTRAINT `material_issue_subs_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `material_requests`
--
ALTER TABLE `material_requests`
  ADD CONSTRAINT `material_requests_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `material_requests_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `material_requests_job_id_foreign` FOREIGN KEY (`job_id`) REFERENCES `job_cards` (`id`),
  ADD CONSTRAINT `material_requests_production_id_foreign` FOREIGN KEY (`production_id`) REFERENCES `production_orders` (`id`),
  ADD CONSTRAINT `material_requests_production_log_id_foreign` FOREIGN KEY (`production_log_id`) REFERENCES `production_order_logs` (`id`),
  ADD CONSTRAINT `material_requests_work_id_foreign` FOREIGN KEY (`work_id`) REFERENCES `workcenters` (`id`),
  ADD CONSTRAINT `material_requests_workorder_id_foreign` FOREIGN KEY (`workorder_id`) REFERENCES `workorders` (`id`);

--
-- Constraints for table `material_request_subs`
--
ALTER TABLE `material_request_subs`
  ADD CONSTRAINT `material_request_subs_auom_id_foreign` FOREIGN KEY (`auom_id`) REFERENCES `uoms` (`id`),
  ADD CONSTRAINT `material_request_subs_brand_name_foreign` FOREIGN KEY (`brand_name`) REFERENCES `product_vendors_subs` (`id`),
  ADD CONSTRAINT `material_request_subs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `material_request_subs_production_id_foreign` FOREIGN KEY (`production_id`) REFERENCES `production_orders` (`id`),
  ADD CONSTRAINT `material_request_subs_production_sub_id_foreign` FOREIGN KEY (`production_sub_id`) REFERENCES `production_order_subs` (`id`),
  ADD CONSTRAINT `material_request_subs_request_id_foreign` FOREIGN KEY (`request_id`) REFERENCES `material_requests` (`id`),
  ADD CONSTRAINT `material_request_subs_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `menuitems`
--
ALTER TABLE `menuitems`
  ADD CONSTRAINT `menuitems_menu_id_foreign` FOREIGN KEY (`menu_id`) REFERENCES `menus` (`id`);

--
-- Constraints for table `mobilemenuitems`
--
ALTER TABLE `mobilemenuitems`
  ADD CONSTRAINT `mobilemenuitems_menu_id_foreign` FOREIGN KEY (`menu_id`) REFERENCES `menus` (`id`);

--
-- Constraints for table `mobilemenupermissions`
--
ALTER TABLE `mobilemenupermissions`
  ADD CONSTRAINT `mobilemenupermissions_form_id_foreign` FOREIGN KEY (`form_id`) REFERENCES `mobilemenuitems` (`id`),
  ADD CONSTRAINT `mobilemenupermissions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- 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 `monthly_holidays_subs`
--
ALTER TABLE `monthly_holidays_subs`
  ADD CONSTRAINT `monthly_holidays_subs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `monthly_holidays` (`id`);

--
-- Constraints for table `otherincomes`
--
ALTER TABLE `otherincomes`
  ADD CONSTRAINT `otherincomes_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branch_creations` (`id`),
  ADD CONSTRAINT `otherincomes_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `otherincomes_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `otherincomes_gate_pass_id_foreign` FOREIGN KEY (`gate_pass_id`) REFERENCES `gate_passes` (`id`),
  ADD CONSTRAINT `otherincomes_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `otherincomes_paymentterm_id_foreign` FOREIGN KEY (`paymentterm_id`) REFERENCES `paymentterms` (`id`),
  ADD CONSTRAINT `otherincomes_receipt_id_foreign` FOREIGN KEY (`receipt_id`) REFERENCES `collectionforms` (`id`),
  ADD CONSTRAINT `otherincomes_salesperson_id_foreign` FOREIGN KEY (`salesperson_id`) REFERENCES `staffbranches` (`id`),
  ADD CONSTRAINT `otherincomes_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `assets` (`id`);

--
-- Constraints for table `otherincomesubs`
--
ALTER TABLE `otherincomesubs`
  ADD CONSTRAINT `otherincomesubs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `otherincomes` (`id`),
  ADD CONSTRAINT `otherincomesubs_otherincometype_id_foreign` FOREIGN KEY (`otherincometype_id`) REFERENCES `otherincometypes` (`id`),
  ADD CONSTRAINT `otherincomesubs_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`id`),
  ADD CONSTRAINT `otherincomesubs_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `otherincometypes`
--
ALTER TABLE `otherincometypes`
  ADD CONSTRAINT `otherincometypes_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `outersalestrips`
--
ALTER TABLE `outersalestrips`
  ADD CONSTRAINT `outersalestrips_assign_truck_id_foreign` FOREIGN KEY (`assign_truck_id`) REFERENCES `truckassigns` (`id`),
  ADD CONSTRAINT `outersalestrips_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `outersalestrips_po_id_foreign` FOREIGN KEY (`po_id`) REFERENCES `purchase_orders` (`id`),
  ADD CONSTRAINT `outersalestrips_sales_id_foreign` FOREIGN KEY (`sales_id`) REFERENCES `salesorders` (`id`),
  ADD CONSTRAINT `outersalestrips_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shiftcreations` (`id`),
  ADD CONSTRAINT `outersalestrips_trip_id_foreign` FOREIGN KEY (`trip_id`) REFERENCES `tripmasters` (`id`);

--
-- Constraints for table `outersalestripsubs`
--
ALTER TABLE `outersalestripsubs`
  ADD CONSTRAINT `outersalestripsubs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `outersalestrips` (`id`),
  ADD CONSTRAINT `outersalestripsubs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `outersalestripsubs_sales_id_foreign` FOREIGN KEY (`sales_id`) REFERENCES `salesorders` (`id`),
  ADD CONSTRAINT `outersalestripsubs_sales_sub_id_foreign` FOREIGN KEY (`sales_sub_id`) REFERENCES `salesorder_subs` (`id`),
  ADD CONSTRAINT `outersalestripsubs_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `outertriptrackings`
--
ALTER TABLE `outertriptrackings`
  ADD CONSTRAINT `outertriptrackings_outertrip_id_foreign` FOREIGN KEY (`outertrip_id`) REFERENCES `outersalestrips` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `outertrip_weightments`
--
ALTER TABLE `outertrip_weightments`
  ADD CONSTRAINT `outertrip_weightments_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `outertrip_weightments_outertrip_id_foreign` FOREIGN KEY (`outertrip_id`) REFERENCES `outersalestrips` (`id`);

--
-- Constraints for table `outer_triploadings`
--
ALTER TABLE `outer_triploadings`
  ADD CONSTRAINT `outer_triploadings_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `outer_triploadings_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `outer_triploadings_outertrip_id_foreign` FOREIGN KEY (`outertrip_id`) REFERENCES `outersalestrips` (`id`);

--
-- Constraints for table `over_times`
--
ALTER TABLE `over_times`
  ADD CONSTRAINT `over_times_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `over_times_salary_type_foreign` FOREIGN KEY (`salary_type`) REFERENCES `salary_types` (`id`);

--
-- Constraints for table `over_time_subs`
--
ALTER TABLE `over_time_subs`
  ADD CONSTRAINT `over_time_subs_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `over_time_subs_main_division_id_foreign` FOREIGN KEY (`main_division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `over_time_subs_ot_id_foreign` FOREIGN KEY (`ot_id`) REFERENCES `over_times` (`id`),
  ADD CONSTRAINT `over_time_subs_salary_type_foreign` FOREIGN KEY (`salary_type`) REFERENCES `salary_types` (`id`),
  ADD CONSTRAINT `over_time_subs_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shiftcreations` (`id`),
  ADD CONSTRAINT `over_time_subs_sub_division_id_foreign` FOREIGN KEY (`sub_division_id`) REFERENCES `divisions` (`id`);

--
-- Constraints for table `payment_vouchers`
--
ALTER TABLE `payment_vouchers`
  ADD CONSTRAINT `payment_vouchers_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `payment_vouchers_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `payment_vouchers_main_ledger_id_foreign` FOREIGN KEY (`main_ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `payment_vouchers_receipt_id_foreign` FOREIGN KEY (`receipt_id`) REFERENCES `collectionforms` (`id`),
  ADD CONSTRAINT `payment_vouchers_schedule_payment_id_foreign` FOREIGN KEY (`schedule_payment_id`) REFERENCES `schedulepayments` (`id`),
  ADD CONSTRAINT `payment_vouchers_schedulepayment_id_foreign` FOREIGN KEY (`schedulepayment_id`) REFERENCES `schedulepayments` (`id`);

--
-- Constraints for table `payment_voucher_subs`
--
ALTER TABLE `payment_voucher_subs`
  ADD CONSTRAINT `payment_voucher_subs_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `payment_voucher_subs_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `payment_voucher_subs_payment_voucher_id_foreign` FOREIGN KEY (`payment_voucher_id`) REFERENCES `payment_vouchers` (`id`),
  ADD CONSTRAINT `payment_voucher_subs_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `permissions`
--
ALTER TABLE `permissions`
  ADD CONSTRAINT `permissions_form_id_foreign` FOREIGN KEY (`form_id`) REFERENCES `menuitems` (`id`);

--
-- Constraints for table `privatevehiclemobiles`
--
ALTER TABLE `privatevehiclemobiles`
  ADD CONSTRAINT `privatevehiclemobiles_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `privatevehicles` (`id`);

--
-- Constraints for table `productionroutings`
--
ALTER TABLE `productionroutings`
  ADD CONSTRAINT `productionroutings_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`);

--
-- Constraints for table `productionroutingsubs`
--
ALTER TABLE `productionroutingsubs`
  ADD CONSTRAINT `productionroutingsubs_machinecenter_id_foreign` FOREIGN KEY (`machinecenter_id`) REFERENCES `machine_centers` (`id`),
  ADD CONSTRAINT `productionroutingsubs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `productionroutings` (`id`),
  ADD CONSTRAINT `productionroutingsubs_workcenter_id_foreign` FOREIGN KEY (`workcenter_id`) REFERENCES `work_centers` (`id`);

--
-- Constraints for table `production_orders`
--
ALTER TABLE `production_orders`
  ADD CONSTRAINT `production_orders_bom_id_foreign` FOREIGN KEY (`bom_id`) REFERENCES `standard_boms` (`id`),
  ADD CONSTRAINT `production_orders_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `production_orders_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `production_orders_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `production_orders_routing_id_foreign` FOREIGN KEY (`routing_id`) REFERENCES `productionroutings` (`id`),
  ADD CONSTRAINT `production_orders_sales_id_foreign` FOREIGN KEY (`sales_id`) REFERENCES `salesorders` (`id`),
  ADD CONSTRAINT `production_orders_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `production_order_logs`
--
ALTER TABLE `production_order_logs`
  ADD CONSTRAINT `production_order_logs_production_order_id_foreign` FOREIGN KEY (`production_order_id`) REFERENCES `production_orders` (`id`),
  ADD CONSTRAINT `production_order_logs_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `production_order_log_fixed_costs`
--
ALTER TABLE `production_order_log_fixed_costs`
  ADD CONSTRAINT `production_order_log_fixed_costs_production_log_id_foreign` FOREIGN KEY (`production_log_id`) REFERENCES `production_order_logs` (`id`),
  ADD CONSTRAINT `production_order_log_fixed_costs_production_order_id_foreign` FOREIGN KEY (`production_order_id`) REFERENCES `production_orders` (`id`),
  ADD CONSTRAINT `production_order_log_fixed_costs_work_center_id_foreign` FOREIGN KEY (`work_center_id`) REFERENCES `work_centers` (`id`);

--
-- Constraints for table `production_order_log_machine_cenetrs`
--
ALTER TABLE `production_order_log_machine_cenetrs`
  ADD CONSTRAINT `production_order_log_machine_cenetrs_machine_center_id_foreign` FOREIGN KEY (`machine_center_id`) REFERENCES `machine_centers` (`id`),
  ADD CONSTRAINT `production_order_log_machine_cenetrs_production_log_id_foreign` FOREIGN KEY (`production_log_id`) REFERENCES `production_order_logs` (`id`),
  ADD CONSTRAINT `production_order_log_machine_cenetrs_production_order_id_foreign` FOREIGN KEY (`production_order_id`) REFERENCES `production_orders` (`id`),
  ADD CONSTRAINT `production_order_log_machine_cenetrs_work_center_id_foreign` FOREIGN KEY (`work_center_id`) REFERENCES `work_centers` (`id`);

--
-- Constraints for table `production_order_log_work_cenetrs`
--
ALTER TABLE `production_order_log_work_cenetrs`
  ADD CONSTRAINT `production_order_log_work_cenetrs_production_log_id_foreign` FOREIGN KEY (`production_log_id`) REFERENCES `production_order_logs` (`id`),
  ADD CONSTRAINT `production_order_log_work_cenetrs_production_order_id_foreign` FOREIGN KEY (`production_order_id`) REFERENCES `production_orders` (`id`),
  ADD CONSTRAINT `production_order_log_work_cenetrs_work_center_id_foreign` FOREIGN KEY (`work_center_id`) REFERENCES `work_centers` (`id`);

--
-- Constraints for table `production_order_machine_centers`
--
ALTER TABLE `production_order_machine_centers`
  ADD CONSTRAINT `production_order_machine_centers_machine_center_id_foreign` FOREIGN KEY (`machine_center_id`) REFERENCES `machine_centers` (`id`),
  ADD CONSTRAINT `production_order_machine_centers_production_order_id_foreign` FOREIGN KEY (`production_order_id`) REFERENCES `production_orders` (`id`),
  ADD CONSTRAINT `production_order_machine_centers_work_center_id_foreign` FOREIGN KEY (`work_center_id`) REFERENCES `work_centers` (`id`);

--
-- Constraints for table `production_order_subs`
--
ALTER TABLE `production_order_subs`
  ADD CONSTRAINT `production_order_subs_bom_sub_id_foreign` FOREIGN KEY (`bom_sub_id`) REFERENCES `standard_bom_subs` (`id`),
  ADD CONSTRAINT `production_order_subs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `production_order_subs_production_order_id_foreign` FOREIGN KEY (`production_order_id`) REFERENCES `production_orders` (`id`),
  ADD CONSTRAINT `production_order_subs_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `production_order_trackings`
--
ALTER TABLE `production_order_trackings`
  ADD CONSTRAINT `production_order_trackings_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `production_orders` (`id`);

--
-- Constraints for table `production_order_work_centers`
--
ALTER TABLE `production_order_work_centers`
  ADD CONSTRAINT `production_order_work_centers_production_order_id_foreign` FOREIGN KEY (`production_order_id`) REFERENCES `production_orders` (`id`),
  ADD CONSTRAINT `production_order_work_centers_work_center_id_foreign` FOREIGN KEY (`work_center_id`) REFERENCES `work_centers` (`id`);

--
-- Constraints for table `production_routing_machines`
--
ALTER TABLE `production_routing_machines`
  ADD CONSTRAINT `production_routing_machines_machinecenter_id_foreign` FOREIGN KEY (`machinecenter_id`) REFERENCES `machine_centers` (`id`),
  ADD CONSTRAINT `production_routing_machines_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `productionroutings` (`id`),
  ADD CONSTRAINT `production_routing_machines_workcenter_id_foreign` FOREIGN KEY (`workcenter_id`) REFERENCES `work_centers` (`id`);

--
-- Constraints for table `products`
--
ALTER TABLE `products`
  ADD CONSTRAINT `products_inventory_ledger_id_foreign` FOREIGN KEY (`inventory_ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `products_product_group_id_foreign` FOREIGN KEY (`product_group_id`) REFERENCES `product_groups` (`id`),
  ADD CONSTRAINT `products_purchase_ledger_id_foreign` FOREIGN KEY (`purchase_ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `products_sales_ledger_id_foreign` FOREIGN KEY (`sales_ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `products_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `productstandard_consumptions`
--
ALTER TABLE `productstandard_consumptions`
  ADD CONSTRAINT `productstandard_consumptions_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `productstandard_consumptions_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `productuoms`
--
ALTER TABLE `productuoms`
  ADD CONSTRAINT `productuoms_auom_id_foreign` FOREIGN KEY (`auom_id`) REFERENCES `uoms` (`id`),
  ADD CONSTRAINT `productuoms_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `productuoms_uom_foreign` FOREIGN KEY (`uom`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `product_costs`
--
ALTER TABLE `product_costs`
  ADD CONSTRAINT `product_costs_cost_id_foreign` FOREIGN KEY (`cost_id`) REFERENCES `product_cost_types` (`id`),
  ADD CONSTRAINT `product_costs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`);

--
-- Constraints for table `product_cost_types`
--
ALTER TABLE `product_cost_types`
  ADD CONSTRAINT `product_cost_types_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `product_groups`
--
ALTER TABLE `product_groups`
  ADD CONSTRAINT `product_groups_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `productcategories` (`id`);

--
-- Constraints for table `product_routings`
--
ALTER TABLE `product_routings`
  ADD CONSTRAINT `product_routings_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `product_routings_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `product_routings_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `product_routing_subs`
--
ALTER TABLE `product_routing_subs`
  ADD CONSTRAINT `product_routing_subs_route_id_foreign` FOREIGN KEY (`route_id`) REFERENCES `product_routings` (`id`),
  ADD CONSTRAINT `product_routing_subs_workcenter_id_foreign` FOREIGN KEY (`workcenter_id`) REFERENCES `workcenters` (`id`);

--
-- Constraints for table `product_vendors_subs`
--
ALTER TABLE `product_vendors_subs`
  ADD CONSTRAINT `product_vendors_subs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `product_vendors_subs_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `projectcompletions`
--
ALTER TABLE `projectcompletions`
  ADD CONSTRAINT `projectcompletions_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `projectcreations` (`id`);

--
-- Constraints for table `projectcompletionsubs`
--
ALTER TABLE `projectcompletionsubs`
  ADD CONSTRAINT `projectcompletionsubs_dc_qty_uom_id_foreign` FOREIGN KEY (`dc_qty_uom_id`) REFERENCES `uoms` (`id`),
  ADD CONSTRAINT `projectcompletionsubs_estimated_qty_uom_id_foreign` FOREIGN KEY (`estimated_qty_uom_id`) REFERENCES `uoms` (`id`),
  ADD CONSTRAINT `projectcompletionsubs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `projectcompletions` (`id`),
  ADD CONSTRAINT `projectcompletionsubs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`);

--
-- Constraints for table `projectcreations`
--
ALTER TABLE `projectcreations`
  ADD CONSTRAINT `projectcreations_contractor_id_foreign` FOREIGN KEY (`contractor_id`) REFERENCES `suppliers` (`id`),
  ADD CONSTRAINT `projectcreations_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `projectcreations_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `projectcreations_executive_id_foreign` FOREIGN KEY (`executive_id`) REFERENCES `staffbranches` (`id`),
  ADD CONSTRAINT `projectcreations_layingsite_id_foreign` FOREIGN KEY (`layingsite_id`) REFERENCES `customeraddresses` (`id`),
  ADD CONSTRAINT `projectcreations_officesite_id_foreign` FOREIGN KEY (`officesite_id`) REFERENCES `customeraddresses` (`id`),
  ADD CONSTRAINT `projectcreations_projectcompletion_id_foreign` FOREIGN KEY (`projectcompletion_id`) REFERENCES `projectcompletions` (`id`);

--
-- Constraints for table `project_measurement_details`
--
ALTER TABLE `project_measurement_details`
  ADD CONSTRAINT `project_measurement_details_measured_by_foreign` FOREIGN KEY (`measured_by`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `project_measurement_details_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `projectcreations` (`id`);

--
-- Constraints for table `purchasebooks`
--
ALTER TABLE `purchasebooks`
  ADD CONSTRAINT `purchasebooks_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `purchasebooks_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `purchasebooks_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `purchasereturns`
--
ALTER TABLE `purchasereturns`
  ADD CONSTRAINT `purchasereturns_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `purchasereturns_grnbill_id_foreign` FOREIGN KEY (`grnbill_id`) REFERENCES `grn_bills` (`id`),
  ADD CONSTRAINT `purchasereturns_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `purchasereturns_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `purchasereturns_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `purchasereturn_subs`
--
ALTER TABLE `purchasereturn_subs`
  ADD CONSTRAINT `purchasereturn_subs_grnbillsub_id_foreign` FOREIGN KEY (`grnbillsub_id`) REFERENCES `grn_bill_subs` (`id`),
  ADD CONSTRAINT `purchasereturn_subs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `purchasereturns` (`id`),
  ADD CONSTRAINT `purchasereturn_subs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`);

--
-- Constraints for table `purchase_advances`
--
ALTER TABLE `purchase_advances`
  ADD CONSTRAINT `purchase_advances_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `purchase_advances_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `purchase_advances_group_company_foreign` FOREIGN KEY (`group_company`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `purchase_advances_paid_id_foreign` FOREIGN KEY (`paid_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `purchase_advances_paid_ledger_id_foreign` FOREIGN KEY (`paid_ledger_id`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `purchase_advance_revises`
--
ALTER TABLE `purchase_advance_revises`
  ADD CONSTRAINT `purchase_advance_revises_cash_paid_ledger_foreign` FOREIGN KEY (`cash_paid_ledger`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `purchase_advance_revises_purchase_advance_id_foreign` FOREIGN KEY (`purchase_advance_id`) REFERENCES `purchase_advances` (`id`);

--
-- Constraints for table `purchase_advance_revise_subs`
--
ALTER TABLE `purchase_advance_revise_subs`
  ADD CONSTRAINT `purchase_advance_revise_subs_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `purchase_advance_revise_subs_purchase_advance_revise_id_foreign` FOREIGN KEY (`purchase_advance_revise_id`) REFERENCES `purchase_advance_revises` (`id`);

--
-- Constraints for table `purchase_orders`
--
ALTER TABLE `purchase_orders`
  ADD CONSTRAINT `purchase_orders_bill_address_id_foreign` FOREIGN KEY (`bill_address_id`) REFERENCES `company_addresses` (`id`),
  ADD CONSTRAINT `purchase_orders_billing_address_id_foreign` FOREIGN KEY (`billing_address_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `purchase_orders_delivery_id_foreign` FOREIGN KEY (`delivery_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `purchase_orders_other_id_foreign` FOREIGN KEY (`other_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `purchase_orders_ship_address_id_foreign` FOREIGN KEY (`ship_address_id`) REFERENCES `company_addresses` (`id`),
  ADD CONSTRAINT `purchase_orders_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `purchase_order_subs`
--
ALTER TABLE `purchase_order_subs`
  ADD CONSTRAINT `purchase_order_subs_brand_name_foreign` FOREIGN KEY (`brand_name`) REFERENCES `product_vendors_subs` (`id`),
  ADD CONSTRAINT `purchase_order_subs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `purchase_order_subs_purchase_order_id_foreign` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`),
  ADD CONSTRAINT `purchase_order_subs_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `purchase_order_trackings`
--
ALTER TABLE `purchase_order_trackings`
  ADD CONSTRAINT `purchase_order_trackings_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `purchase_orders` (`id`);

--
-- Constraints for table `purchase_quotations`
--
ALTER TABLE `purchase_quotations`
  ADD CONSTRAINT `purchase_quotations_purchase_id_foreign` FOREIGN KEY (`purchase_id`) REFERENCES `purchase_requests` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `purchase_requests`
--
ALTER TABLE `purchase_requests`
  ADD CONSTRAINT `purchase_requests_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `purchase_requests_inter_from_division_foreign` FOREIGN KEY (`inter_from_division`) REFERENCES `divisions` (`id`);

--
-- Constraints for table `purchase_request_subs`
--
ALTER TABLE `purchase_request_subs`
  ADD CONSTRAINT `purchase_request_subs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `purchase_request_subs_purchase_id_foreign` FOREIGN KEY (`purchase_id`) REFERENCES `purchase_requests` (`id`),
  ADD CONSTRAINT `purchase_request_subs_request_sub_id_foreign` FOREIGN KEY (`request_sub_id`) REFERENCES `material_request_subs` (`id`),
  ADD CONSTRAINT `purchase_request_subs_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `receiptadjustment_subs`
--
ALTER TABLE `receiptadjustment_subs`
  ADD CONSTRAINT `receiptadjustment_subs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `collectionforms` (`id`);

--
-- Constraints for table `receipt_vouchers`
--
ALTER TABLE `receipt_vouchers`
  ADD CONSTRAINT `receipt_vouchers_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `receipt_vouchers_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `receipt_vouchers_main_ledger_id_foreign` FOREIGN KEY (`main_ledger_id`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `receipt_voucher_subs`
--
ALTER TABLE `receipt_voucher_subs`
  ADD CONSTRAINT `receipt_voucher_subs_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `receipt_voucher_subs_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `receipt_voucher_subs_receipt_voucher_id_foreign` FOREIGN KEY (`receipt_voucher_id`) REFERENCES `receipt_vouchers` (`id`),
  ADD CONSTRAINT `receipt_voucher_subs_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `refundforms`
--
ALTER TABLE `refundforms`
  ADD CONSTRAINT `refundforms_creditnote_id_foreign` FOREIGN KEY (`creditnote_id`) REFERENCES `creditnotes` (`id`),
  ADD CONSTRAINT `refundforms_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `refundforms_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `refundforms_groupcompany_id_foreign` FOREIGN KEY (`groupcompany_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `refundforms_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `refundforms_receipt_id_foreign` FOREIGN KEY (`receipt_id`) REFERENCES `collectionforms` (`id`);

--
-- 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 `salary_creations`
--
ALTER TABLE `salary_creations`
  ADD CONSTRAINT `salary_creations_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `salary_creations_salary_type_foreign` FOREIGN KEY (`salary_type`) REFERENCES `salary_types` (`id`);

--
-- Constraints for table `salary_creation_components_subs`
--
ALTER TABLE `salary_creation_components_subs`
  ADD CONSTRAINT `salary_creation_components_subs_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `salary_creation_components_subs_salary_id_foreign` FOREIGN KEY (`salary_id`) REFERENCES `salary_creations` (`id`),
  ADD CONSTRAINT `salary_creation_components_subs_salary_sub_id_foreign` FOREIGN KEY (`salary_sub_id`) REFERENCES `salary_creation_subs` (`id`);

--
-- Constraints for table `salary_creation_subs`
--
ALTER TABLE `salary_creation_subs`
  ADD CONSTRAINT `salary_creation_subs_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `salary_creation_subs_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `salary_creation_subs_salary_id_foreign` FOREIGN KEY (`salary_id`) REFERENCES `salary_creations` (`id`),
  ADD CONSTRAINT `salary_creation_subs_salary_type_foreign` FOREIGN KEY (`salary_type`) REFERENCES `salary_types` (`id`);

--
-- Constraints for table `salary_pays`
--
ALTER TABLE `salary_pays`
  ADD CONSTRAINT `salary_pays_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `salary_pays_paid_id_foreign` FOREIGN KEY (`paid_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `salary_pays_salary_id_foreign` FOREIGN KEY (`salary_id`) REFERENCES `salary_creations` (`id`);

--
-- Constraints for table `salary_pay_subs`
--
ALTER TABLE `salary_pay_subs`
  ADD CONSTRAINT `salary_pay_subs_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `salary_pay_subs_salary_id_foreign` FOREIGN KEY (`salary_id`) REFERENCES `salary_creations` (`id`),
  ADD CONSTRAINT `salary_pay_subs_salary_pay_id_foreign` FOREIGN KEY (`salary_pay_id`) REFERENCES `salary_pays` (`id`),
  ADD CONSTRAINT `salary_pay_subs_salary_sub_id_foreign` FOREIGN KEY (`salary_sub_id`) REFERENCES `salary_creation_subs` (`id`);

--
-- Constraints for table `salescosts`
--
ALTER TABLE `salescosts`
  ADD CONSTRAINT `salescosts_costtype_id_foreign` FOREIGN KEY (`costtype_id`) REFERENCES `product_cost_types` (`id`),
  ADD CONSTRAINT `salescosts_dc_id_foreign` FOREIGN KEY (`dc_id`) REFERENCES `sales_dcs` (`id`),
  ADD CONSTRAINT `salescosts_inter_trip_inward_id_foreign` FOREIGN KEY (`inter_trip_inward_id`) REFERENCES `inter_company_inwards` (`id`),
  ADD CONSTRAINT `salescosts_sales_return_receive_id_foreign` FOREIGN KEY (`sales_return_receive_id`) REFERENCES `salesreturnreceives` (`id`),
  ADD CONSTRAINT `salescosts_salesorder_id_foreign` FOREIGN KEY (`salesorder_id`) REFERENCES `salesorders` (`id`);

--
-- Constraints for table `salesdiscounts`
--
ALTER TABLE `salesdiscounts`
  ADD CONSTRAINT `salesdiscounts_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branch_creations` (`id`),
  ADD CONSTRAINT `salesdiscounts_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `salesdiscounts_discountreason_id_foreign` FOREIGN KEY (`discountreason_id`) REFERENCES `discountreasons` (`id`),
  ADD CONSTRAINT `salesdiscounts_salesperson_id_foreign` FOREIGN KEY (`salesperson_id`) REFERENCES `staffbranches` (`id`);

--
-- Constraints for table `salesdiscountsubs`
--
ALTER TABLE `salesdiscountsubs`
  ADD CONSTRAINT `salesdiscountsubs_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `salesdiscountsubs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `salesdiscounts` (`id`);

--
-- Constraints for table `salesgateins`
--
ALTER TABLE `salesgateins`
  ADD CONSTRAINT `salesgateins_assign_truck_id_foreign` FOREIGN KEY (`assign_truck_id`) REFERENCES `truckassigns` (`id`),
  ADD CONSTRAINT `salesgateins_outertrip_id_foreign` FOREIGN KEY (`outertrip_id`) REFERENCES `outersalestrips` (`id`),
  ADD CONSTRAINT `salesgateins_salesreturn_id_foreign` FOREIGN KEY (`salesreturn_id`) REFERENCES `salesreturns` (`id`),
  ADD CONSTRAINT `salesgateins_truck_id_foreign` FOREIGN KEY (`truck_id`) REFERENCES `assets` (`id`);

--
-- Constraints for table `salesinvoices`
--
ALTER TABLE `salesinvoices`
  ADD CONSTRAINT `salesinvoices_billing_id_foreign` FOREIGN KEY (`billing_id`) REFERENCES `customeraddresses` (`id`),
  ADD CONSTRAINT `salesinvoices_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `salesinvoices_dc_id_foreign` FOREIGN KEY (`dc_id`) REFERENCES `sales_dcs` (`id`),
  ADD CONSTRAINT `salesinvoices_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `salesinvoices_shipping_id_foreign` FOREIGN KEY (`shipping_id`) REFERENCES `customeraddresses` (`id`);

--
-- Constraints for table `salesinvoicesubs`
--
ALTER TABLE `salesinvoicesubs`
  ADD CONSTRAINT `salesinvoicesubs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `salesinvoices` (`id`),
  ADD CONSTRAINT `salesinvoicesubs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `salesinvoicesubs_salesdc_subid_foreign` FOREIGN KEY (`salesdc_subid`) REFERENCES `sales_dc_subs` (`id`),
  ADD CONSTRAINT `salesinvoicesubs_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`id`),
  ADD CONSTRAINT `salesinvoicesubs_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `salesorders`
--
ALTER TABLE `salesorders`
  ADD CONSTRAINT `salesorders_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branch_creations` (`id`),
  ADD CONSTRAINT `salesorders_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `salesorders_deliverysite_id_foreign` FOREIGN KEY (`deliverysite_id`) REFERENCES `customeraddresses` (`id`),
  ADD CONSTRAINT `salesorders_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `salesorders_estimation_id_foreign` FOREIGN KEY (`estimation_id`) REFERENCES `estimationforms` (`id`),
  ADD CONSTRAINT `salesorders_paymentterm_id_foreign` FOREIGN KEY (`paymentterm_id`) REFERENCES `paymentterms` (`id`),
  ADD CONSTRAINT `salesorders_po_id_foreign` FOREIGN KEY (`po_id`) REFERENCES `customerpos` (`id`),
  ADD CONSTRAINT `salesorders_salesperson_id_foreign` FOREIGN KEY (`salesperson_id`) REFERENCES `staffbranches` (`id`),
  ADD CONSTRAINT `salesorders_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`id`),
  ADD CONSTRAINT `salesorders_unloading_type_id_foreign` FOREIGN KEY (`unloading_type_id`) REFERENCES `loading_types` (`id`);

--
-- Constraints for table `salesorder_subs`
--
ALTER TABLE `salesorder_subs`
  ADD CONSTRAINT `salesorder_subs_estimation_sub_id_foreign` FOREIGN KEY (`estimation_sub_id`) REFERENCES `estimationformsubs` (`id`),
  ADD CONSTRAINT `salesorder_subs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `salesorders` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `salesorder_subs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `salesorder_subs_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`id`),
  ADD CONSTRAINT `salesorder_subs_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `salesorder_vehicles`
--
ALTER TABLE `salesorder_vehicles`
  ADD CONSTRAINT `salesorder_vehicles_dispatch_id_foreign` FOREIGN KEY (`dispatch_id`) REFERENCES `division_dispatch_vehicles` (`id`),
  ADD CONSTRAINT `salesorder_vehicles_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `salesorder_vehicles_sales_id_foreign` FOREIGN KEY (`sales_id`) REFERENCES `salesorders` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `salesreturnreceives`
--
ALTER TABLE `salesreturnreceives`
  ADD CONSTRAINT `salesreturnreceives_return_trip_id_foreign` FOREIGN KEY (`return_trip_id`) REFERENCES `sales_return_trips` (`id`),
  ADD CONSTRAINT `salesreturnreceives_return_trip_sub_id_foreign` FOREIGN KEY (`return_trip_sub_id`) REFERENCES `sales_return_trip_subs` (`id`),
  ADD CONSTRAINT `salesreturnreceives_salesreturn_id_foreign` FOREIGN KEY (`salesreturn_id`) REFERENCES `salesreturns` (`id`);

--
-- Constraints for table `salesreturnreceivesubs`
--
ALTER TABLE `salesreturnreceivesubs`
  ADD CONSTRAINT `salesreturnreceivesubs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `salesreturnreceives` (`id`),
  ADD CONSTRAINT `salesreturnreceivesubs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `salesreturnreceivesubs_salesreturn_id_foreign` FOREIGN KEY (`salesreturn_id`) REFERENCES `salesreturns` (`id`),
  ADD CONSTRAINT `salesreturnreceivesubs_salesreturn_subid_foreign` FOREIGN KEY (`salesreturn_subid`) REFERENCES `salesreturnsubs` (`id`),
  ADD CONSTRAINT `salesreturnreceivesubs_warehouse_id_acc_foreign` FOREIGN KEY (`warehouse_id_acc`) REFERENCES `warehouses` (`id`),
  ADD CONSTRAINT `salesreturnreceivesubs_warehouse_id_rej_foreign` FOREIGN KEY (`warehouse_id_rej`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `salesreturns`
--
ALTER TABLE `salesreturns`
  ADD CONSTRAINT `salesreturns_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `salesreturns_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `salesreturns_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `salesreturns_salesorder_id_foreign` FOREIGN KEY (`salesorder_id`) REFERENCES `salesorders` (`id`),
  ADD CONSTRAINT `salesreturns_salesperson_id_foreign` FOREIGN KEY (`salesperson_id`) REFERENCES `staffbranches` (`id`),
  ADD CONSTRAINT `salesreturns_truck_id_foreign` FOREIGN KEY (`truck_id`) REFERENCES `assets` (`id`);

--
-- Constraints for table `salesreturnsubs`
--
ALTER TABLE `salesreturnsubs`
  ADD CONSTRAINT `salesreturnsubs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `salesreturns` (`id`),
  ADD CONSTRAINT `salesreturnsubs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `salesreturnsubs_reason_foreign` FOREIGN KEY (`reason`) REFERENCES `salesreturnreasons` (`id`),
  ADD CONSTRAINT `salesreturnsubs_salesorder_id_foreign` FOREIGN KEY (`salesorder_id`) REFERENCES `salesorders` (`id`),
  ADD CONSTRAINT `salesreturnsubs_salesorder_subid_foreign` FOREIGN KEY (`salesorder_subid`) REFERENCES `salesorder_subs` (`id`);

--
-- Constraints for table `sales_dcs`
--
ALTER TABLE `sales_dcs`
  ADD CONSTRAINT `sales_dcs_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branch_creations` (`id`),
  ADD CONSTRAINT `sales_dcs_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `sales_dcs_deliverysite_id_foreign` FOREIGN KEY (`deliverysite_id`) REFERENCES `customeraddresses` (`id`),
  ADD CONSTRAINT `sales_dcs_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `sales_dcs_groupcompany_id_foreign` FOREIGN KEY (`groupcompany_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `sales_dcs_outertrip_id_foreign` FOREIGN KEY (`outertrip_id`) REFERENCES `outersalestrips` (`id`),
  ADD CONSTRAINT `sales_dcs_paymentterm_id_foreign` FOREIGN KEY (`paymentterm_id`) REFERENCES `paymentterms` (`id`),
  ADD CONSTRAINT `sales_dcs_sales_id_foreign` FOREIGN KEY (`sales_id`) REFERENCES `salesorders` (`id`),
  ADD CONSTRAINT `sales_dcs_salesperson_id_foreign` FOREIGN KEY (`salesperson_id`) REFERENCES `staffbranches` (`id`),
  ADD CONSTRAINT `sales_dcs_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`id`);

--
-- Constraints for table `sales_dc_subs`
--
ALTER TABLE `sales_dc_subs`
  ADD CONSTRAINT `sales_dc_subs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `sales_dcs` (`id`),
  ADD CONSTRAINT `sales_dc_subs_outertrip_sub_id_foreign` FOREIGN KEY (`outertrip_sub_id`) REFERENCES `outersalestripsubs` (`id`),
  ADD CONSTRAINT `sales_dc_subs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `sales_dc_subs_sales_sub_id_foreign` FOREIGN KEY (`sales_sub_id`) REFERENCES `salesorder_subs` (`id`),
  ADD CONSTRAINT `sales_dc_subs_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`id`),
  ADD CONSTRAINT `sales_dc_subs_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `sales_return_trips`
--
ALTER TABLE `sales_return_trips`
  ADD CONSTRAINT `sales_return_trips_assign_truck_id_foreign` FOREIGN KEY (`assign_truck_id`) REFERENCES `truckassigns` (`id`),
  ADD CONSTRAINT `sales_return_trips_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shiftcreations` (`id`),
  ADD CONSTRAINT `sales_return_trips_trip_id_foreign` FOREIGN KEY (`trip_id`) REFERENCES `tripmasters` (`id`);

--
-- Constraints for table `sales_return_trip_subs`
--
ALTER TABLE `sales_return_trip_subs`
  ADD CONSTRAINT `sales_return_trip_subs_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `sales_return_trip_subs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `outersalestrips` (`id`),
  ADD CONSTRAINT `sales_return_trip_subs_sales_return_id_foreign` FOREIGN KEY (`sales_return_id`) REFERENCES `salesreturns` (`id`);

--
-- Constraints for table `sales_return_trip_trackings`
--
ALTER TABLE `sales_return_trip_trackings`
  ADD CONSTRAINT `sales_return_trip_trackings_outertrip_id_foreign` FOREIGN KEY (`outertrip_id`) REFERENCES `sales_return_trips` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `schedulepayments`
--
ALTER TABLE `schedulepayments`
  ADD CONSTRAINT `schedulepayments_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `schedulepayments_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `schedulepayments_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `schedulepayments_loan_account_id_foreign` FOREIGN KEY (`loan_account_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `schedulepayments_paid_through_foreign` FOREIGN KEY (`paid_through`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `schedulepayments_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payment_vouchers` (`id`),
  ADD CONSTRAINT `schedulepayments_schedule_type_id_foreign` FOREIGN KEY (`schedule_type_id`) REFERENCES `schedulepayment_types` (`id`);

--
-- Constraints for table `schedule_payment_month_wises`
--
ALTER TABLE `schedule_payment_month_wises`
  ADD CONSTRAINT `schedule_payment_month_wises_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `schedule_payment_month_wises_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payment_vouchers` (`id`),
  ADD CONSTRAINT `schedule_payment_month_wises_schedule_payment_id_foreign` FOREIGN KEY (`schedule_payment_id`) REFERENCES `schedulepayments` (`id`);

--
-- Constraints for table `service_bills`
--
ALTER TABLE `service_bills`
  ADD CONSTRAINT `service_bills_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `service_bills_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `service_bills_expense_type_id_foreign` FOREIGN KEY (`expense_type_id`) REFERENCES `expense_types` (`id`),
  ADD CONSTRAINT `service_bills_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `service_bills_job_card_id_foreign` FOREIGN KEY (`job_card_id`) REFERENCES `job_cards` (`id`),
  ADD CONSTRAINT `service_bills_other_id_foreign` FOREIGN KEY (`other_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `service_bills_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`),
  ADD CONSTRAINT `service_bills_tcs_id_foreign` FOREIGN KEY (`tcs_id`) REFERENCES `tcs` (`id`),
  ADD CONSTRAINT `service_bills_tds_id_foreign` FOREIGN KEY (`tds_id`) REFERENCES `tds` (`id`),
  ADD CONSTRAINT `service_bills_tds_ledger_foreign` FOREIGN KEY (`tds_ledger`) REFERENCES `accounts_ledgers` (`id`);

--
-- Constraints for table `service_bill_subs`
--
ALTER TABLE `service_bill_subs`
  ADD CONSTRAINT `service_bill_subs_hsn_id_foreign` FOREIGN KEY (`hsn_id`) REFERENCES `hsns` (`id`),
  ADD CONSTRAINT `service_bill_subs_service_bill_id_foreign` FOREIGN KEY (`service_bill_id`) REFERENCES `service_bills` (`id`),
  ADD CONSTRAINT `service_bill_subs_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `service_bill_uploads`
--
ALTER TABLE `service_bill_uploads`
  ADD CONSTRAINT `service_bill_uploads_bill_id_foreign` FOREIGN KEY (`bill_id`) REFERENCES `service_bills` (`id`);

--
-- Constraints for table `service_histories`
--
ALTER TABLE `service_histories`
  ADD CONSTRAINT `service_histories_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `service_histories_assetgroup_foreign` FOREIGN KEY (`assetgroup`) REFERENCES `asset_groups` (`id`),
  ADD CONSTRAINT `service_histories_incharge_id_foreign` FOREIGN KEY (`incharge_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `service_histories_job_card_id_foreign` FOREIGN KEY (`job_card_id`) REFERENCES `job_cards` (`id`),
  ADD CONSTRAINT `service_histories_refer_id_foreign` FOREIGN KEY (`refer_id`) REFERENCES `service_histories` (`id`),
  ADD CONSTRAINT `service_histories_service_name_foreign` FOREIGN KEY (`service_name`) REFERENCES `service_names` (`id`);

--
-- Constraints for table `service_schedules`
--
ALTER TABLE `service_schedules`
  ADD CONSTRAINT `service_schedules_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `service_schedules_assetgroup_foreign` FOREIGN KEY (`assetgroup`) REFERENCES `asset_groups` (`id`),
  ADD CONSTRAINT `service_schedules_service_name_foreign` FOREIGN KEY (`service_name`) REFERENCES `service_names` (`id`);

--
-- Constraints for table `staffbranches`
--
ALTER TABLE `staffbranches`
  ADD CONSTRAINT `staffbranches_staff_id_foreign` FOREIGN KEY (`staff_id`) REFERENCES `employees` (`id`);

--
-- Constraints for table `standard_boms`
--
ALTER TABLE `standard_boms`
  ADD CONSTRAINT `standard_boms_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `standard_boms_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `standard_boms_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `standard_bom_subs`
--
ALTER TABLE `standard_bom_subs`
  ADD CONSTRAINT `standard_bom_subs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `standard_boms` (`id`),
  ADD CONSTRAINT `standard_bom_subs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `standard_bom_subs_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `stockadjustments`
--
ALTER TABLE `stockadjustments`
  ADD CONSTRAINT `stockadjustments_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `stockadjustments_reason_id_foreign` FOREIGN KEY (`reason_id`) REFERENCES `stockreasons` (`id`),
  ADD CONSTRAINT `stockadjustments_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `stockadjustment_subs`
--
ALTER TABLE `stockadjustment_subs`
  ADD CONSTRAINT `stockadjustment_subs_brand_name_foreign` FOREIGN KEY (`brand_name`) REFERENCES `product_vendors_subs` (`id`),
  ADD CONSTRAINT `stockadjustment_subs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `stockadjustments` (`id`),
  ADD CONSTRAINT `stockadjustment_subs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `stockadjustment_subs_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `stocks`
--
ALTER TABLE `stocks`
  ADD CONSTRAINT `stocks_brand_name_foreign` FOREIGN KEY (`brand_name`) REFERENCES `product_vendors_subs` (`id`),
  ADD CONSTRAINT `stocks_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `stocks_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `stocks_purchase_uom_id_foreign` FOREIGN KEY (`purchase_uom_id`) REFERENCES `uoms` (`id`),
  ADD CONSTRAINT `stocks_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`),
  ADD CONSTRAINT `stocks_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `stocktransfers`
--
ALTER TABLE `stocktransfers`
  ADD CONSTRAINT `stocktransfers_destination_division_id_foreign` FOREIGN KEY (`destination_division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `stocktransfers_destination_warehouse_id_foreign` FOREIGN KEY (`destination_warehouse_id`) REFERENCES `warehouses` (`id`),
  ADD CONSTRAINT `stocktransfers_source_division_id_foreign` FOREIGN KEY (`source_division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `stocktransfers_source_warehouse_id_foreign` FOREIGN KEY (`source_warehouse_id`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `stocktransfer_subs`
--
ALTER TABLE `stocktransfer_subs`
  ADD CONSTRAINT `stocktransfer_subs_brand_name_foreign` FOREIGN KEY (`brand_name`) REFERENCES `product_vendors_subs` (`id`),
  ADD CONSTRAINT `stocktransfer_subs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `stocktransfers` (`id`),
  ADD CONSTRAINT `stocktransfer_subs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `stocktransfer_subs_warehouse_id_destination_foreign` FOREIGN KEY (`warehouse_id_destination`) REFERENCES `warehouses` (`id`),
  ADD CONSTRAINT `stocktransfer_subs_warehouse_id_source_foreign` FOREIGN KEY (`warehouse_id_source`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `stock_locations`
--
ALTER TABLE `stock_locations`
  ADD CONSTRAINT `stock_locations_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `stock_locations_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `supplierrefunds`
--
ALTER TABLE `supplierrefunds`
  ADD CONSTRAINT `supplierrefunds_debitnote_id_foreign` FOREIGN KEY (`debitnote_id`) REFERENCES `purchasereturns` (`id`),
  ADD CONSTRAINT `supplierrefunds_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `supplierrefunds_groupcompany_id_foreign` FOREIGN KEY (`groupcompany_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `supplierrefunds_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `supplierrefunds_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `vendor_payments` (`id`),
  ADD CONSTRAINT `supplierrefunds_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `suppliers`
--
ALTER TABLE `suppliers`
  ADD CONSTRAINT `suppliers_payment_terms_id_foreign` FOREIGN KEY (`payment_terms_id`) REFERENCES `paymentterms` (`id`);

--
-- Constraints for table `supplier_transactions`
--
ALTER TABLE `supplier_transactions`
  ADD CONSTRAINT `supplier_transactions_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `supplier_transactions_groupcompany_id_foreign` FOREIGN KEY (`groupcompany_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `supplier_transactions_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `ticket_rises`
--
ALTER TABLE `ticket_rises`
  ADD CONSTRAINT `ticket_rises_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `employees` (`id`);

--
-- Constraints for table `ticket_rise_replies`
--
ALTER TABLE `ticket_rise_replies`
  ADD CONSTRAINT `ticket_rise_replies_rise_id_foreign` FOREIGN KEY (`rise_id`) REFERENCES `ticket_rises` (`id`);

--
-- Constraints for table `transport_routings`
--
ALTER TABLE `transport_routings`
  ADD CONSTRAINT `transport_routings_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `transport_routings_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `transport_routings_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `transport_routing_subs`
--
ALTER TABLE `transport_routing_subs`
  ADD CONSTRAINT `transport_routing_subs_route_id_foreign` FOREIGN KEY (`route_id`) REFERENCES `transport_routings` (`id`),
  ADD CONSTRAINT `transport_routing_subs_workcenter_id_foreign` FOREIGN KEY (`workcenter_id`) REFERENCES `workcenters` (`id`);

--
-- Constraints for table `truckassigns`
--
ALTER TABLE `truckassigns`
  ADD CONSTRAINT `truckassigns_driver_id_foreign` FOREIGN KEY (`driver_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `truckassigns_job_card_id_foreign` FOREIGN KEY (`job_card_id`) REFERENCES `job_cards` (`id`),
  ADD CONSTRAINT `truckassigns_parked_site_id_foreign` FOREIGN KEY (`parked_site_id`) REFERENCES `parked_sites` (`id`),
  ADD CONSTRAINT `truckassigns_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shiftcreations` (`id`),
  ADD CONSTRAINT `truckassigns_truck_id_foreign` FOREIGN KEY (`truck_id`) REFERENCES `assets` (`id`);

--
-- Constraints for table `users`
--
ALTER TABLE `users`
  ADD CONSTRAINT `users_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`);

--
-- Constraints for table `vehiclemeterreadings`
--
ALTER TABLE `vehiclemeterreadings`
  ADD CONSTRAINT `vehiclemeterreadings_vehicle_id_foreign` FOREIGN KEY (`vehicle_id`) REFERENCES `assets` (`id`);

--
-- Constraints for table `vendoropening_balances`
--
ALTER TABLE `vendoropening_balances`
  ADD CONSTRAINT `vendoropening_balances_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `vendoropening_balances_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `vendor_bills`
--
ALTER TABLE `vendor_bills`
  ADD CONSTRAINT `vendor_bills_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `vendor_bills_groupcompany_id_foreign` FOREIGN KEY (`groupcompany_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `vendor_bills_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `vendor_payments`
--
ALTER TABLE `vendor_payments`
  ADD CONSTRAINT `vendor_payments_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `vendor_payments_groupcompany_id_foreign` FOREIGN KEY (`groupcompany_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `vendor_payments_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `vendor_payments_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `projectcreations` (`id`),
  ADD CONSTRAINT `vendor_payments_round_off_division_foreign` FOREIGN KEY (`round_off_division`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `vendor_payments_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `vendor_payment_subs`
--
ALTER TABLE `vendor_payment_subs`
  ADD CONSTRAINT `vendor_payment_subs_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `vendor_payments` (`id`);

--
-- Constraints for table `wages_creations`
--
ALTER TABLE `wages_creations`
  ADD CONSTRAINT `wages_creations_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `wages_creations_salary_type_foreign` FOREIGN KEY (`salary_type`) REFERENCES `salary_types` (`id`);

--
-- Constraints for table `wages_creation_subs`
--
ALTER TABLE `wages_creation_subs`
  ADD CONSTRAINT `wages_creation_subs_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `wages_creation_subs_emp_id_foreign` FOREIGN KEY (`emp_id`) REFERENCES `employees` (`id`),
  ADD CONSTRAINT `wages_creation_subs_salary_type_foreign` FOREIGN KEY (`salary_type`) REFERENCES `salary_types` (`id`),
  ADD CONSTRAINT `wages_creation_subs_wages_id_foreign` FOREIGN KEY (`wages_id`) REFERENCES `wages_creations` (`id`);

--
-- Constraints for table `warehouses`
--
ALTER TABLE `warehouses`
  ADD CONSTRAINT `warehouses_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `warehouses_product_category_id_foreign` FOREIGN KEY (`product_category_id`) REFERENCES `productcategories` (`id`);

--
-- Constraints for table `workcenters`
--
ALTER TABLE `workcenters`
  ADD CONSTRAINT `workcenters_activity_id_foreign` FOREIGN KEY (`activity_id`) REFERENCES `activitycenters` (`id`),
  ADD CONSTRAINT `workcenters_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`);

--
-- Constraints for table `workcenter_standardcosts`
--
ALTER TABLE `workcenter_standardcosts`
  ADD CONSTRAINT `workcenter_standardcosts_workcenter_id_foreign` FOREIGN KEY (`workcenter_id`) REFERENCES `workcenters` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `workcenter_standardcosts_worktype_id_foreign` FOREIGN KEY (`worktype_id`) REFERENCES `worktypes` (`id`);

--
-- Constraints for table `workorderbilldeductions`
--
ALTER TABLE `workorderbilldeductions`
  ADD CONSTRAINT `workorderbilldeductions_workorderbill_id_foreign` FOREIGN KEY (`workorderbill_id`) REFERENCES `workorderbills` (`id`);

--
-- Constraints for table `workorderbills`
--
ALTER TABLE `workorderbills`
  ADD CONSTRAINT `workorderbills_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `workorderbills_group_company_id_foreign` FOREIGN KEY (`group_company_id`) REFERENCES `groupcompanies` (`id`),
  ADD CONSTRAINT `workorderbills_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`),
  ADD CONSTRAINT `workorderbills_workorder_id_foreign` FOREIGN KEY (`workorder_id`) REFERENCES `workorders` (`id`);

--
-- Constraints for table `workorderbillsubs`
--
ALTER TABLE `workorderbillsubs`
  ADD CONSTRAINT `workorderbillsubs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `workorderbills` (`id`),
  ADD CONSTRAINT `workorderbillsubs_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`id`),
  ADD CONSTRAINT `workorderbillsubs_workorder_id_foreign` FOREIGN KEY (`workorder_id`) REFERENCES `workorders` (`id`),
  ADD CONSTRAINT `workorderbillsubs_workordersub_id_foreign` FOREIGN KEY (`workordersub_id`) REFERENCES `workordersubs` (`id`);

--
-- Constraints for table `workorderdedcutions`
--
ALTER TABLE `workorderdedcutions`
  ADD CONSTRAINT `workorderdedcutions_workorder_id_foreign` FOREIGN KEY (`workorder_id`) REFERENCES `workorders` (`id`);

--
-- Constraints for table `workorderlogs`
--
ALTER TABLE `workorderlogs`
  ADD CONSTRAINT `workorderlogs_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `workorderlogs_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projectcreations` (`id`),
  ADD CONSTRAINT `workorderlogs_production_id_foreign` FOREIGN KEY (`production_id`) REFERENCES `production_orders` (`id`),
  ADD CONSTRAINT `workorderlogs_production_log_id_foreign` FOREIGN KEY (`production_log_id`) REFERENCES `production_order_logs` (`id`),
  ADD CONSTRAINT `workorderlogs_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`),
  ADD CONSTRAINT `workorderlogs_work_center_id_foreign` FOREIGN KEY (`work_center_id`) REFERENCES `work_centers` (`id`),
  ADD CONSTRAINT `workorderlogs_workorder_id_foreign` FOREIGN KEY (`workorder_id`) REFERENCES `workorders` (`id`);

--
-- Constraints for table `workorderlogsubs`
--
ALTER TABLE `workorderlogsubs`
  ADD CONSTRAINT `workorderlogsubs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `workorderlogs` (`id`),
  ADD CONSTRAINT `workorderlogsubs_workorder_id_foreign` FOREIGN KEY (`workorder_id`) REFERENCES `workorders` (`id`),
  ADD CONSTRAINT `workorderlogsubs_workordersub_id_foreign` FOREIGN KEY (`workordersub_id`) REFERENCES `workordersubs` (`id`);

--
-- Constraints for table `workorders`
--
ALTER TABLE `workorders`
  ADD CONSTRAINT `workorders_asset_id_foreign` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`),
  ADD CONSTRAINT `workorders_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`),
  ADD CONSTRAINT `workorders_ledger_id_foreign` FOREIGN KEY (`ledger_id`) REFERENCES `accounts_ledgers` (`id`),
  ADD CONSTRAINT `workorders_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `projectcreations` (`id`),
  ADD CONSTRAINT `workorders_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `workordersubs`
--
ALTER TABLE `workordersubs`
  ADD CONSTRAINT `workordersubs_activity_id_foreign` FOREIGN KEY (`activity_id`) REFERENCES `workorderactivities` (`id`),
  ADD CONSTRAINT `workordersubs_main_id_foreign` FOREIGN KEY (`main_id`) REFERENCES `workorders` (`id`),
  ADD CONSTRAINT `workordersubs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `workordersubs_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`id`),
  ADD CONSTRAINT `workordersubs_uom_id_foreign` FOREIGN KEY (`uom_id`) REFERENCES `uoms` (`id`);

--
-- Constraints for table `work_centers`
--
ALTER TABLE `work_centers`
  ADD CONSTRAINT `work_centers_contractor_id_foreign` FOREIGN KEY (`contractor_id`) REFERENCES `suppliers` (`id`),
  ADD CONSTRAINT `work_centers_division_id_foreign` FOREIGN KEY (`division_id`) REFERENCES `divisions` (`id`);

--
-- Constraints for table `work_center_cost_data`
--
ALTER TABLE `work_center_cost_data`
  ADD CONSTRAINT `work_center_cost_data_cost_type_id_foreign` FOREIGN KEY (`cost_type_id`) REFERENCES `work_center_cost_types` (`id`),
  ADD CONSTRAINT `work_center_cost_data_work_center_id_foreign` FOREIGN KEY (`work_center_id`) REFERENCES `work_centers` (`id`);
COMMIT;