-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `micromall`
--

DELIMITER $$
--
-- Functions
--
DROP FUNCTION IF EXISTS `SPLIT_STR`$$
CREATE DEFINER=`mytownkart`@`localhost` FUNCTION `SPLIT_STR` (`x` VARCHAR(255), `delim` VARCHAR(50), `pos` INT(11)) RETURNS VARCHAR(255) CHARSET utf8mb4 NO SQL BEGIN RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos), LENGTH(SUBSTRING_INDEX(x, delim, pos -1)) + 1), delim, ''); 
END$$

DELIMITER ;

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

--
-- Table structure for table `businesstype`
--

CREATE TABLE `businesstype` (
  `ID` int(11) NOT NULL,
  `name` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `description` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `path` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `cancel_till_delivery` enum('pre','post') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'post',
  `cancel_till_time` int(11) NOT NULL DEFAULT 1,
  `cancel_till_time_format` enum('minutes','hours','days') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'minutes',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `category`
--

CREATE TABLE `category` (
  `ID` int(11) NOT NULL,
  `name` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `description` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `path` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `config`
--

CREATE TABLE `config` (
  `ID` int(11) NOT NULL,
  `code` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `input_type` enum('input','switch','dropdown') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'input',
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `value` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `hint` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `shop_id` int(11) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` int(11) NOT NULL DEFAULT 1,
  `updated_by` int(11) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `coupon`
--

CREATE TABLE `coupon` (
  `ID` int(11) NOT NULL,
  `title` varchar(500) NOT NULL,
  `path` varchar(500) NOT NULL DEFAULT '',
  `description` text DEFAULT NULL,
  `code` varchar(50) NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `max_usage` int(11) NOT NULL,
  `discount_type` enum('fixed','percentage') NOT NULL DEFAULT 'percentage',
  `discount_amt` float(8,2) NOT NULL,
  `usage_user` int(11) NOT NULL DEFAULT 0,
  `min_cart_value` float(12,2) DEFAULT NULL,
  `max_discount_amt` float(12,2) DEFAULT NULL,
  `show_banner` tinyint(1) NOT NULL DEFAULT 0,
  `shop_id` int(11) DEFAULT NULL,
  `created_by` int(11) DEFAULT 1,
  `updated_by` int(11) NOT NULL DEFAULT 1,
  `updated_at` varchar(155) DEFAULT NULL,
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `coupon_location`
--

CREATE TABLE `coupon_location` (
  `ID` int(11) NOT NULL,
  `coupon_id` int(11) DEFAULT NULL,
  `location_id` int(11) DEFAULT NULL,
  `code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `location`
--

CREATE TABLE `location` (
  `ID` int(11) NOT NULL,
  `name` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `pincode` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `description` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `high_demand` tinyint(1) NOT NULL DEFAULT 0,
  `additional_delivery_charge` float(10,2) NOT NULL DEFAULT 0.00,
  `path` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `shop_id` int(11) NOT NULL DEFAULT 0,
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `location_delivery_charge`
--

CREATE TABLE `location_delivery_charge` (
  `ID` int(11) NOT NULL,
  `from_km` float(10,2) NOT NULL DEFAULT 0.00,
  `to_km` float(10,2) NOT NULL DEFAULT 0.00,
  `amount` float(10,2) NOT NULL DEFAULT 0.00,
  `margin_percentage` float(10,2) DEFAULT NULL,
  `location_id` int(11) DEFAULT NULL,
  `code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `location_meta`
--

CREATE TABLE `location_meta` (
  `ID` int(11) NOT NULL,
  `meta_key` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `meta_value` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `location_id` int(11) DEFAULT NULL,
  `code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) NOT NULL DEFAULT 1,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

CREATE TABLE `notifications` (
  `ID` int(11) NOT NULL,
  `subject` varchar(500) NOT NULL,
  `body` text NOT NULL,
  `type` varchar(50) NOT NULL,
  `to_email` varchar(500) NOT NULL,
  `attachment_url` varchar(500) NOT NULL,
  `attachment_name` varchar(200) NOT NULL,
  `from_email` varchar(500) NOT NULL,
  `from_name` varchar(500) NOT NULL,
  `to_name` varchar(500) NOT NULL,
  `cc_email` varchar(200) NOT NULL,
  `cc_name` varchar(200) NOT NULL,
  `body_text` text DEFAULT NULL,
  `shop_id` int(11) DEFAULT NULL,
  `code` varchar(155) NOT NULL DEFAULT '',
  `response` text DEFAULT NULL,
  `status` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` varchar(155) DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `payment_mode`
--

CREATE TABLE `payment_mode` (
  `ID` int(11) NOT NULL,
  `code` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` int(11) NOT NULL DEFAULT 1,
  `updated_by` int(11) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `product`
--

CREATE TABLE `product` (
  `ID` int(11) NOT NULL,
  `name` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `description` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `product_image`
--

CREATE TABLE `product_image` (
  `ID` int(11) NOT NULL,
  `path` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `product_id` int(11) DEFAULT NULL,
  `code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) NOT NULL DEFAULT 1,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `shop`
--

CREATE TABLE `shop` (
  `ID` int(11) NOT NULL,
  `name` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `description` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `path` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL,
  `address1` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `address2` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `lat` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `lng` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `place_name` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `location_id` int(11) DEFAULT NULL,
  `businesstype_id` int(11) DEFAULT NULL,
  `contact_person` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `mobile` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `email` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `landline` varchar(12) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `open_time` time DEFAULT NULL,
  `close_time` time DEFAULT NULL,
  `contact_person_designation` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `gst` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `commission_type` enum('product','order') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'product',
  `commission_percent_per_order` float(10,2) NOT NULL DEFAULT 0.00,
  `isopen` tinyint(1) DEFAULT 1,
  `beneficiary` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `account_no` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `ifsc_code` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `upi_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `hostname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `android_app_link` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `iOS_app_link` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Triggers `shop`
--
DROP TRIGGER IF EXISTS `create_login_for_shop`;
DELIMITER $$

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('CUSTOMER_ONESIGNAL_APP_ID', 'input', 'Customer Onesignal App ID', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('TWILIO_AUTH_TOKEN', 'input', 'Twilio Auth Token', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('TWILIO_PHONE_NUMBER', 'input', 'Twilio Phone', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('TWILIO_SID', 'input', 'Twilio SID', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('DELIVERY_ONESIGNAL_APP_ID', 'input', 'Delivery Onesignal App ID', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('SUPERVISOR_ONESIGNAL_APP_ID', 'input', 'Supervisor Onesignal App ID', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('ONLINE_PAYMENT', 'switch', 'Online payment', '1', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('CASHFREE_SECRET_KEY', 'input', 'CashFree secret key', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('CASHFREE_ENV', 'input', 'CashFree environment', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('CASHFREE_APP_ID', 'input', 'CashFree App ID', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('FAST2SMS_AUTHORIZATION', 'input', 'Fast2SMS Authorization', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('FAST2SMS_ROUTE', 'input', 'Fast2SMS Route', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('FAST2SMS_SENDER_ID', 'input', 'Fast2SMS Sender ID', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('SHOP_ONESIGNAL_APP_ID', 'input', 'Shop Onesignal ID', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('PRIVACY_POLICY', 'input', 'Privacy policy', 'Privacy policy page', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('CONTACT_EMAIL', 'input', 'Contact Email', NEW.email, '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('CONTACT_PHONE', 'input', 'Contact Phone', NEW.mobile, '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('ABOUT_US', 'input', 'About Us', 'About us page', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('TXTLCL_API_KEY', 'input', 'Text Local API Key', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('TXTLCL_SENDER', 'input', 'Text Local Sender ID', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('SMS_GATEWAY', 'input', 'SMS Gateway', '', 'TXTLCL/TWILIO/FAST2SMS', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('FACEBOOK_LINK', 'input', 'Facebook Link', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('INSTAGRAM_LINK', 'input', 'Instagram Link', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('YOUTUBE_LINK', 'input', 'YouTube Link', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('X_LINK', 'input', 'X Link', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('PAYMENT_GATEWAY', 'input', 'Payment Gateway', 'RAZORPAY', 'RAZORPAY/CASHFREE', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('RAZORPAY_KEY_ID', 'input', 'Razorpay Key ID', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('RAZORPAY_KEY_SECRET', 'input', 'Razorpay Key Secret', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('RAZORPAY_THEME_COLOR', 'input', 'Razorpay Theme Color', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

INSERT INTO config (code, input_type, name, value, hint, shop_id, created_at, updated_at, status, created_by, updated_by) VALUES ('RAZORPAY_LOGO_PATH', 'input', 'Razorpay Logo Path', '', '', NEW.ID, NEW.created_at, NEW.updated_at, 1, NEW.created_by, NEW.updated_by);

END
$$
DELIMITER ;
DROP TRIGGER IF EXISTS `update_login_for_shop`;
DELIMITER $$END
$$
DELIMITER ;

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

--
-- Table structure for table `shop_product`
--

CREATE TABLE `shop_product` (
  `ID` int(11) NOT NULL,
  `shop_id` int(11) DEFAULT NULL,
  `product_id` int(11) DEFAULT NULL,
  `category_id` int(11) DEFAULT NULL,
  `unit_id` int(11) DEFAULT NULL,
  `commission` float(10,2) NOT NULL DEFAULT 0.00,
  `code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Triggers `shop_product`
--
DROP TRIGGER IF EXISTS `check_product_change`;
DELIMITER $$
CREATE TRIGGER `check_product_change` AFTER UPDATE ON `shop_product` FOR EACH ROW BEGIN
IF OLD.product_id != NEW.product_id THEN
DELETE FROM shop_product_image WHERE shop_product_id = OLD.ID;
END IF;
END
$$
DELIMITER ;
DROP TRIGGER IF EXISTS `check_unit_change`;
DELIMITER $$
CREATE TRIGGER `check_unit_change` AFTER UPDATE ON `shop_product` FOR EACH ROW BEGIN
IF OLD.unit_id != NEW.unit_id THEN
DELETE FROM shop_product_unit_size WHERE shop_product_id = OLD.ID;
END IF;
END
$$
DELIMITER ;

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

--
-- Table structure for table `shop_product_image`
--

CREATE TABLE `shop_product_image` (
  `ID` int(11) NOT NULL,
  `shop_product_id` int(11) DEFAULT NULL,
  `product_image_id` int(11) DEFAULT NULL,
  `code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `updated_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `shop_product_unit_size`
--

CREATE TABLE `shop_product_unit_size` (
  `ID` int(11) NOT NULL,
  `shop_product_id` int(11) DEFAULT NULL,
  `unit_size_id` int(11) DEFAULT NULL,
  `amount` float(12,2) DEFAULT NULL,
  `tax` float(5,2) DEFAULT NULL,
  `discount_type` enum('fixed','percentage') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'fixed',
  `code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL,
  `discount_amount` float(10,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `shop_settlement`
--

CREATE TABLE `shop_settlement` (
  `ID` int(11) NOT NULL,
  `code` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `shop_id` int(11) DEFAULT NULL,
  `requested_amount` float(12,2) DEFAULT NULL,
  `settled_amount` float(12,2) DEFAULT NULL,
  `declined_reason` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `payment_mode_id` int(11) DEFAULT NULL,
  `transaction_id` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `transaction_date` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `status` enum('requested','completed','declined') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'requested',
  `created_by` int(11) NOT NULL DEFAULT 1,
  `updated_by` int(11) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `staff_location`
--

CREATE TABLE `staff_location` (
  `ID` int(11) NOT NULL,
  `staff_id` int(11) DEFAULT NULL,
  `location_id` int(11) DEFAULT NULL,
  `code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `staff_notification`
--

CREATE TABLE `staff_notification` (
  `ID` int(11) NOT NULL,
  `title` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `staff_id` int(11) DEFAULT NULL,
  `is_readed` tinyint(1) NOT NULL DEFAULT 0,
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL,
  `code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `staff_settlement`
--

CREATE TABLE `staff_settlement` (
  `ID` int(11) NOT NULL,
  `code` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `staff_id` int(11) DEFAULT NULL,
  `requested_amount` float(12,2) DEFAULT NULL,
  `settled_amount` float(12,2) DEFAULT NULL,
  `declined_reason` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `payment_mode_id` int(11) DEFAULT NULL,
  `transaction_id` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `transaction_date` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `status` enum('requested','completed','declined') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'requested',
  `created_by` int(11) NOT NULL DEFAULT 1,
  `updated_by` int(11) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `staff_task`
--

CREATE TABLE `staff_task` (
  `ID` int(11) NOT NULL,
  `title` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `staff_id` int(11) DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_completed` tinyint(1) NOT NULL DEFAULT 0,
  `staff_reply` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reply_attachment` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Triggers `staff_task`
--
DROP TRIGGER IF EXISTS `Add complete notification`;
DELIMITER $$
CREATE TRIGGER `Add complete notification` AFTER UPDATE ON `staff_task` FOR EACH ROW BEGIN
IF NEW.is_completed = 1 THEN
INSERT INTO staff_notification (title, staff_id, code, created_at, created_by, updated_at, updated_by) VALUES ('Your task marked as completed', OLD.staff_id, CONCAT('staffnotification-', SPLIT_STR(NEW.code, '-', 2), OLD.ID),  NEW.updated_at, NEW.updated_by, NEW.updated_at, NEW.updated_by);
END IF;
END
$$
DELIMITER ;
DROP TRIGGER IF EXISTS `Add to notification`;
DELIMITER $$
CREATE TRIGGER `Add to notification` AFTER INSERT ON `staff_task` FOR EACH ROW BEGIN

INSERT INTO staff_notification (title, staff_id, code, created_at, created_by, updated_at, updated_by) VALUES ('New task added to you', NEW.staff_id, CONCAT('staffnotification-', SPLIT_STR(NEW.code, '-', 2)),  NEW.created_at, NEW.created_by, NEW.updated_at, NEW.updated_by);

END
$$
DELIMITER ;

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

--
-- Table structure for table `unit`
--

CREATE TABLE `unit` (
  `ID` int(11) NOT NULL,
  `name` varchar(50) NOT NULL DEFAULT '',
  `sign` varchar(20) NOT NULL DEFAULT '',
  `break_point` int(11) NOT NULL DEFAULT 0,
  `break_point_name` varchar(50) NOT NULL DEFAULT '',
  `break_point_sign` varchar(20) NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) NOT NULL DEFAULT '',
  `created_by` int(11) NOT NULL DEFAULT 1,
  `updated_at` varchar(155) NOT NULL DEFAULT '',
  `updated_by` int(11) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `unit_size`
--

CREATE TABLE `unit_size` (
  `ID` int(11) NOT NULL,
  `unit_id` int(11) NOT NULL DEFAULT 0,
  `name` varchar(50) NOT NULL DEFAULT '',
  `value` int(11) NOT NULL DEFAULT 0,
  `code` varchar(60) NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Triggers `user`
--
DROP TRIGGER IF EXISTS `user_AFTER_INSERT`;
DELIMITER $$
END
$$
DELIMITER ;
DROP TRIGGER IF EXISTS `user_AFTER_UPDATE`;
DELIMITER $$
END
$$
DELIMITER ;

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

--
-- Table structure for table `user_address`
--

CREATE TABLE `user_address` (
  `ID` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `location_id` int(11) DEFAULT NULL,
  `name` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `address_line1` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `address_line2` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL,
  `landmark` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `map_address` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `lat` varchar(60) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `lng` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `mobile` varchar(15) COLLATE utf8mb4_unicode_ci DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `user_order`
--

CREATE TABLE `user_order` (
  `ID` int(11) NOT NULL,
  `shop_id` int(11) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `address_name` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `address_line1` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `address_line2` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `landmark` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `map_address` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `lat` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `lng` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `pincode` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `coupon_code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `discount_amount` float(12,2) DEFAULT NULL,
  `total_amount` float(12,2) DEFAULT NULL,
  `tax_amount` float(12,2) DEFAULT NULL,
  `grand_amount` float(12,2) DEFAULT NULL,
  `notes` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `delivery_staff_id` int(11) DEFAULT NULL,
  `delivery_code` int(11) DEFAULT NULL,
  `payment_type` enum('cod','online') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'cod',
  `transaction_id` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` enum('placed','accepted','packed','shipped','delivered','rejected') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'placed',
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL,
  `code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `distance` varchar(60) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `reject_reason` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `delivery_amount` float(12,2) DEFAULT NULL,
  `high_demand` tinyint(1) NOT NULL DEFAULT 0,
  `high_demand_amount` float(12,2) DEFAULT NULL,
  `commission_type` enum('product','order') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'order',
  `commission_amt` float(12,2) DEFAULT NULL,
  `commission_configured_amt` float(12,2) DEFAULT NULL,
  `review_shop` int(11) DEFAULT NULL,
  `review_service` int(11) DEFAULT NULL,
  `review_comment` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `settled_cod_amt` tinyint(1) DEFAULT 0,
  `delivery_commission` float(12,2) DEFAULT 2.00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `user_order_item`
--

CREATE TABLE `user_order_item` (
  `ID` int(11) NOT NULL,
  `user_order_id` int(11) DEFAULT NULL,
  `product_name` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `category_name` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `unit_id` int(11) DEFAULT NULL,
  `unit_size_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `unit_size_value` int(11) DEFAULT NULL,
  `quantity` int(11) DEFAULT NULL,
  `amount` float(12,2) DEFAULT NULL,
  `discount_type` enum('fixed','percentage') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'fixed',
  `discount_amount` float(12,2) DEFAULT NULL,
  `return_unit_size_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `return_unit_size_value` int(11) DEFAULT NULL,
  `code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `commission_configured_amt` float(12,2) DEFAULT NULL,
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `user_order_review`
--

CREATE TABLE `user_order_review` (
  `ID` int(11) NOT NULL,
  `user_order_id` int(11) DEFAULT NULL,
  `delivery` float(2,1) DEFAULT NULL,
  `quality` float(2,1) DEFAULT NULL,
  `comment` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `user_order_status`
--

CREATE TABLE `user_order_status` (
  `ID` int(11) NOT NULL,
  `order_id` int(11) DEFAULT NULL,
  `status` enum('placed','accepted','packed','shipped','delivered') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'placed',
  `code` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `created_by` int(11) DEFAULT NULL,
  `updated_at` varchar(155) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `updated_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `businesstype`
--
ALTER TABLE `businesstype`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `category`
--
ALTER TABLE `category`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `config`
--
ALTER TABLE `config`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `coupon`
--
ALTER TABLE `coupon`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `coupon_location`
--
ALTER TABLE `coupon_location`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `location`
--
ALTER TABLE `location`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `location_delivery_charge`
--
ALTER TABLE `location_delivery_charge`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `location_meta`
--
ALTER TABLE `location_meta`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `payment_mode`
--
ALTER TABLE `payment_mode`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `product`
--
ALTER TABLE `product`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `product_image`
--
ALTER TABLE `product_image`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `shop`
--
ALTER TABLE `shop`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `shop_product`
--
ALTER TABLE `shop_product`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `shop_product_image`
--
ALTER TABLE `shop_product_image`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `shop_product_unit_size`
--
ALTER TABLE `shop_product_unit_size`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `shop_settlement`
--
ALTER TABLE `shop_settlement`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `staff_location`
--
ALTER TABLE `staff_location`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `staff_notification`
--
ALTER TABLE `staff_notification`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `staff_settlement`
--
ALTER TABLE `staff_settlement`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `staff_task`
--
ALTER TABLE `staff_task`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `unit`
--
ALTER TABLE `unit`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `unit_size`
--
ALTER TABLE `unit_size`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `user_address`
--
ALTER TABLE `user_address`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `user_order`
--
ALTER TABLE `user_order`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `user_order_item`
--
ALTER TABLE `user_order_item`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `user_order_review`
--
ALTER TABLE `user_order_review`
  ADD PRIMARY KEY (`ID`);

--
-- Indexes for table `user_order_status`
--
ALTER TABLE `user_order_status`
  ADD PRIMARY KEY (`ID`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `businesstype`
--
ALTER TABLE `businesstype`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `category`
--
ALTER TABLE `category`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `config`
--
ALTER TABLE `config`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `coupon`
--
ALTER TABLE `coupon`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `coupon_location`
--
ALTER TABLE `coupon_location`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `location`
--
ALTER TABLE `location`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `location_delivery_charge`
--
ALTER TABLE `location_delivery_charge`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `location_meta`
--
ALTER TABLE `location_meta`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `payment_mode`
--
ALTER TABLE `payment_mode`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `product`
--
ALTER TABLE `product`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `product_image`
--
ALTER TABLE `product_image`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `shop`
--
ALTER TABLE `shop`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `shop_product`
--
ALTER TABLE `shop_product`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `shop_product_image`
--
ALTER TABLE `shop_product_image`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `shop_product_unit_size`
--
ALTER TABLE `shop_product_unit_size`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `shop_settlement`
--
ALTER TABLE `shop_settlement`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `staff_location`
--
ALTER TABLE `staff_location`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `staff_notification`
--
ALTER TABLE `staff_notification`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `staff_settlement`
--
ALTER TABLE `staff_settlement`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `staff_task`
--
ALTER TABLE `staff_task`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `unit`
--
ALTER TABLE `unit`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `unit_size`
--
ALTER TABLE `unit_size`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_address`
--
ALTER TABLE `user_address`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_order`
--
ALTER TABLE `user_order`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_order_item`
--
ALTER TABLE `user_order_item`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_order_review`
--
ALTER TABLE `user_order_review`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;

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

