--
-- Host: localhost    Database: kafeklou_dbv1
-- ------------------------------------------------------


--
-- Table structure for table `associate_reviews`
--

CREATE TABLE `associate_reviews` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `associate_name` text NOT NULL,
  `logo` text,
  `rating` decimal(2,1) DEFAULT NULL,
  `review` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `associate_reviews`
--


--
-- Table structure for table `cart`
--

CREATE TABLE `cart` (
  `user_id` int(11) NOT NULL,
  `item_id` int(11) NOT NULL,
  `day_of_week` enum('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Trial') NOT NULL DEFAULT 'Monday',
  `group_id` int(11) DEFAULT NULL,
  `quantity` int(11) NOT NULL DEFAULT '1',
  `set_default` tinyint(1) DEFAULT '0',
  `set_current` tinyint(1) DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`user_id`,`item_id`,`day_of_week`),
  KEY `cart_item_id_fkey_idx` (`item_id`),
  KEY `cart_group_id_fkey` (`group_id`),
  CONSTRAINT `cart_group_id_fkey` FOREIGN KEY (`group_id`) REFERENCES `user_groups` (`group_id`) ON UPDATE CASCADE,
  CONSTRAINT `cart_item_id_fkey` FOREIGN KEY (`item_id`) REFERENCES `menu_items` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `cart`
--


--
-- Table structure for table `delivery_locations`
--

CREATE TABLE `delivery_locations` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `city` varchar(255) NOT NULL,
  `location` text NOT NULL,
  `latitude` decimal(12,8) NOT NULL,
  `longitude` decimal(12,8) NOT NULL,
  `pincodes` text,
  `radius` int(11) DEFAULT NULL,
  `status` enum ('DS' ,'DA', 'DWO') NOT NULL DEFAULT 'DA',
  `location_pic` text,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `delivery_locations`
--

INSERT INTO `delivery_locations` VALUES (1,'Bengaluru','Marathahalli',12.95917220,77.69741900,'560037',5,'DA','images/app/locations/marathalli.jpg','2018-07-06 07:12:24',NULL),(2,'Bengaluru','Bellandur',12.92603080,77.67624630,'560103',5,'DA','images/app/locations/2.jpg','2018-07-09 04:50:57',NULL),(3,'Bengaluru','BTM Layout',12.91657570,77.61011630,'560029,560068,560076',5,'DA','images/app/locations/3.jpg','2018-07-09 04:51:43',NULL),(4,'Bengaluru','Jayanagar',12.92500740,77.59380280,'560041',5,'DA','images/app/locations/4.jpg','2018-07-09 04:52:36',NULL),(5,'Bengaluru','Koramangala',12.92792320,77.62710780,'560034',5,'DA','images/app/locations/5.jpg','2018-07-09 04:53:19',NULL),(6,'Bengaluru','Madiwala',12.92263730,77.61744420,'560068',5,'DA','images/app/locations/6.jpg','2018-07-09 04:54:22',NULL),(7,'Bengaluru','Bommanahalli',12.89836010,77.61794650,'560076',5,'DA','images/app/locations/7.jpg','2018-07-09 04:55:19',NULL),(8,'Bengaluru','Electronic City',12.83993890,77.67700310,'560100',5,'DA','images/app/locations/8.jpg','2018-07-09 04:56:25',NULL),(9,'Bengaluru','HSR Layout',12.90813570,77.64760800,'560102',5,'DA','images/app/locations/9.jpg','2018-07-09 04:56:56',NULL);

--
-- Table structure for table `group_memberships`
--

CREATE TABLE `group_memberships` (
  `group_id` int(11) NOT NULL,
  `member_id` int(11) NOT NULL,
  `active` tinyint(4) NOT NULL DEFAULT '1',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`group_id`,`member_id`),
  KEY `group_memberships_member_fkey_idx` (`member_id`),
  CONSTRAINT `group_memberships_group_fkey` FOREIGN KEY (`group_id`) REFERENCES `user_groups` (`group_id`) ON UPDATE CASCADE,
  CONSTRAINT `group_memberships_member_fkey` FOREIGN KEY (`member_id`) REFERENCES `user_profiles` (`user_id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `group_memberships`
--


--
-- Table structure for table `item_reviews`
--

CREATE TABLE `item_reviews` (
  `user_id` int(11) NOT NULL,
  `item_id` int(11) NOT NULL,
  `rating` decimal(2,1) NOT NULL,
  `review` text NOT NULL,
  `moderate` enum('Hide','Show','ShowOnHomePage') DEFAULT 'Show',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`user_id`,`item_id`),
  KEY `item_review_item_id_fkey` (`item_id`),
  CONSTRAINT `item_review_item_id_fkey` FOREIGN KEY (`item_id`) REFERENCES `menu_items` (`id`) ON UPDATE CASCADE,
  CONSTRAINT `item_review_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `user_profiles` (`user_id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `item_reviews`
--



--
-- Table structure for table `menu_items`
--

CREATE TABLE `menu_items` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `item_name` varchar(45) NOT NULL,
  `short_description` varchar(100) NOT NULL,
  `item_description` text NOT NULL,
  `category` int(11) NOT NULL,
  `food_type` enum('Veg','Non-Veg') NOT NULL DEFAULT 'Veg',
  `max_price` decimal(8,2) NOT NULL,
  `trial_price` decimal(8,2) NULL,
  `available` tinyint(1) DEFAULT '1',
  `exclusive` tinyint(1) DEFAULT '0',
  `item_pic_0` text,
  `item_pic_1` text,
  `item_pic_2` text,
  `item_thumbnail` text,
  `calories` decimal(8,3) DEFAULT NULL,
  `carbs` text,
  `proteins` text,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `menu_items_cat_fkey` (`category`),
  CONSTRAINT `menu_items_cat_fkey` FOREIGN KEY (`category`) REFERENCES `option_values` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `menu_items`
--


--
-- Table structure for table `menu_pricing`
--

CREATE TABLE `menu_pricing` (
  `item_id` int(11) NOT NULL,
  `subscription_type` enum('Group','Individual','Trial') NOT NULL,
  `plan_id` int(11) NOT NULL,
  `price` decimal(10,0) NOT NULL,
  `quantity` text,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`item_id`,`subscription_type`,`plan_id`),
  KEY `menu_pricing_plan_id_fkey_idx` (`plan_id`),
  CONSTRAINT `menu_pricing_item_id_fkey` FOREIGN KEY (`item_id`) REFERENCES `menu_items` (`id`) ON UPDATE CASCADE,
  CONSTRAINT `menu_pricing_plan_id_fkey` FOREIGN KEY (`plan_id`) REFERENCES `option_values` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `menu_pricing`
--

INSERT INTO `menu_pricing` VALUES (1,'Group',6,210,NULL,'2018-04-08 05:59:59',NULL),(1,'Group',7,200,NULL,'2018-04-08 06:27:07',NULL),(1,'Individual',6,220,NULL,'2018-04-08 06:27:52',NULL),(2,'Group',6,180,NULL,'2018-05-02 17:30:09',NULL);

--
-- Table structure for table `option_types`
--

CREATE TABLE `option_types` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type_name` varchar(45) NOT NULL,
  `active` tinyint(4) NOT NULL DEFAULT '1',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `option_types`
--

INSERT INTO `option_types` VALUES (1,'Home Page Settings',1,'2018-04-06 17:49:29',NULL),(2,'Email Settings',1,'2018-04-06 17:49:34',NULL),(3,'SMS Settings',1,'2018-04-06 17:49:40',NULL),(4,'Subscription Plans',1,'2018-04-07 09:32:07',NULL),(5,'Menu Categories',1,'2018-04-07 17:18:14',NULL),(6,'Tax Settings',1,'2018-04-10 14:30:00',NULL),(7,'Facebook Settings',1,'2018-05-06 11:56:27',NULL),(8,'Twitter Settings',1,'2018-05-06 11:56:43',NULL),(9,'Google+ Settings',1,'2018-05-06 11:56:56',NULL),(10,'Linkedin Settings',1,'2018-05-06 11:57:12',NULL),(11,'Delivery Timings',1,'2018-06-07 17:03:31',NULL), (12,'Company Names',1,'2018-04-06 17:49:29',NULL);

--
-- Table structure for table `option_values`
--

CREATE TABLE `option_values` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `option_type` int(11) NOT NULL,
  `type_name` varchar(45) NOT NULL,
  `active` tinyint(4) NOT NULL DEFAULT '1',
  `value` text,
  `attribute_1` text,
  `attribute_2` text,
  `attribute_3` text,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `option_values_type_id_fkey_idx` (`option_type`),
  CONSTRAINT `option_values_option_type_fkey` FOREIGN KEY (`option_type`) REFERENCES `option_types` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `option_values`
--

INSERT INTO `option_values` VALUES (1,2,'Server Name',1,'md-in-16.webhostbox.net',NULL,NULL,NULL,'2018-04-06 17:56:18',NULL),(2,2,'User Name',1,'clientdemos@scienstechnologies.in',NULL,NULL,NULL,'2018-04-06 17:56:45',NULL),(3,2,'Password',1,'clientdemos123',NULL,NULL,NULL,'2018-04-06 17:57:03',NULL),(4,2,'Port',1,'465',NULL,NULL,NULL,'2018-04-06 17:57:28',NULL),(5,2,'Encryption Type',1,'ssl',NULL,NULL,NULL,'2018-04-06 17:57:43',NULL),(6,4,'Weekly',1,'7',NULL,NULL,NULL,'2018-04-07 09:33:09',NULL),(7,4,'Fortnight',1,'15',NULL,NULL,NULL,'2018-04-07 09:33:28',NULL),(8,4,'Monthly',1,'30',NULL,NULL,NULL,'2018-04-07 09:33:49',NULL),(9,4,'3 Months',1,'90',NULL,NULL,NULL,'2018-04-07 09:34:07',NULL),(10,5,'South Indian',1,'--',NULL,NULL,NULL,'2018-04-07 17:18:54',NULL),(11,5,'North Indian',1,'--',NULL,NULL,NULL,'2018-04-07 17:18:59',NULL),(12,5,'Salads',1,'--',NULL,NULL,NULL,'2018-04-07 17:19:05',NULL),(13,5,'Italian',1,'--',NULL,NULL,NULL,'2018-04-07 17:19:10',NULL),(14,5,'Combos',1,'--',NULL,NULL,NULL,'2018-04-07 17:19:25',NULL),(15,5,'Desserts',1,'--',NULL,NULL,NULL,'2018-04-07 17:19:33',NULL),(16,5,'Sweets',1,'--',NULL,NULL,NULL,'2018-04-07 17:19:38',NULL),(17,6,'CGST',1,'2.5',NULL,NULL,NULL,'2018-04-10 14:30:41',NULL),(18,6,'SGST',1,'3.5',NULL,NULL,NULL,'2018-04-10 14:30:47',NULL),(19,7,'Client ID',1,'1092921984079976',NULL,NULL,NULL,'2018-05-06 11:58:32',NULL),(20,7,'Client Secret',1,'9659297fbb0c6c0dade3587235c8b9d6',NULL,NULL,NULL,'2018-05-06 11:59:07',NULL),(21,8,'Consumer Secret',1,'4oXKvru2wteM0TjpUv1LLLT9hGvsXjQB07pJHiNqhkt0MEsTud',NULL,NULL,NULL,'2018-05-06 11:59:40',NULL),(22,8,'Consumer Key',1,'r6ZkRs5jOl5xZHCNLFciWRFnS',NULL,NULL,NULL,'2018-05-06 12:00:06',NULL),(23,9,'Client ID',1,'1093142894425-pjcgop1bgbhci7qgvc47lpta1k15l8co.apps.googleusercontent.com',NULL,NULL,NULL,'2018-05-06 12:00:39',NULL),(24,9,'Client Secret',1,'5ZUFPUAoK8j2-monGrF2v8c3',NULL,NULL,NULL,'2018-05-06 12:01:06',NULL),(25,10,'Client ID',1,'81u7mykqt9gvf6',NULL,NULL,NULL,'2018-05-06 12:01:45',NULL),(26,10,'Client Secret',1,'4nC09tQlC13RCehm',NULL,NULL,NULL,'2018-05-06 12:02:10',NULL),(27,1,'Logo',1,'images/app/header1/logo.png',NULL,NULL,NULL,'2018-06-05 05:18:22',NULL),(28,1,'Address',1,'Test Address',NULL,NULL,NULL,'2018-06-05 05:18:22',NULL),(29,3,'Gateway URL',1,'http://smsapi.iton.in/api/',NULL,NULL,NULL,'2018-06-05 05:18:39',NULL),(30,3,'Username',1,'scienstech',NULL,NULL,NULL,'2018-06-05 05:18:39',NULL),(31,3,'Password',1,'Sciens@123',NULL,NULL,NULL,'2018-06-05 05:18:39',NULL),(32,3,'SenderId',1,'KAFEKL',NULL,NULL,NULL,'2018-06-05 05:18:39',NULL),(33,1,'Footer Logo',1,'images/app/header1/footer_logo.png',NULL,NULL,NULL,'2018-06-05 13:17:22',NULL),(34,1,'Business Contact',1,'080 443332211',NULL,NULL,NULL,'2018-06-05 14:40:50',NULL),(35,1,'Support Mail',1,'support@kafekloud.com',NULL,NULL,NULL,'2018-06-05 14:41:23',NULL),(36,11,'Delivery Timings',1,'11:20 AM','02:30 PM','05:00 PM',NULL,'2018-06-07 17:06:17',NULL);

--
-- Table structure for table `order_details`
--

CREATE TABLE `order_details` (
  `order_id` int(11) NOT NULL,
  `item_id` int(11) NOT NULL,
  `quantity` int(11) NOT NULL DEFAULT '1',
  `item_price` decimal(10,0) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`order_id`,`item_id`),
  KEY `order_details_order_id_fkey_idx` (`order_id`),
  KEY `order_details_item_id_fkey_idx` (`item_id`),
  CONSTRAINT `order_details_item_id_fkey` FOREIGN KEY (`item_id`) REFERENCES `menu_items` (`id`) ON UPDATE CASCADE,
  CONSTRAINT `order_details_order_id_fkey` FOREIGN KEY (`order_id`) REFERENCES `orders` (`order_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `order_details`
--


--
-- Table structure for table `order_reviews`
--

CREATE TABLE `order_reviews` (
  `user_id` int(11) NOT NULL,
  `order_id` int(11) NOT NULL,
  `rating` decimal(2,1) NOT NULL,
  `review` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`user_id`,`order_id`),
  KEY `order_review_order_id_fkey` (`order_id`),
  CONSTRAINT `order_review_order_id_fkey` FOREIGN KEY (`order_id`) REFERENCES `orders` (`order_id`) ON UPDATE CASCADE,
  CONSTRAINT `order_review_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `user_profiles` (`user_id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `order_reviews`
--

--
-- Table structure for table `order_taxes`
--

CREATE TABLE `order_taxes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `order_id` int(11) NOT NULL,
  `tax_string` varchar(45) NOT NULL,
  `tax_perc` decimal(3,2) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `order_taxes_order_id_fkey` (`order_id`),
  CONSTRAINT `order_taxes_order_id_fkey` FOREIGN KEY (`order_id`) REFERENCES `orders` (`order_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `order_taxes`
--


--
-- Table structure for table `order_transactions`
--

CREATE TABLE `order_transactions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `order_id` int(11) NOT NULL,
  `paid_by` int(11) NOT NULL,
  `amount_paid` decimal(10,2) NOT NULL,
  `txn_reference` text,
  `pay_mode` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `order_txn_paid_by_fkey` (`paid_by`),
  KEY `order_txn_order_id_fkey` (`order_id`),
  CONSTRAINT `order_txn_order_id_fkey` FOREIGN KEY (`order_id`) REFERENCES `orders` (`order_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `order_txn_paid_by_fkey` FOREIGN KEY (`paid_by`) REFERENCES `user_profiles` (`user_id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `order_transactions`
--


--
-- Table structure for table `orders`
--

CREATE TABLE `orders` (
  `order_id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `plan_id` int(11) NOT NULL,
  `order_date` date NOT NULL,
  `order_status` enum('Placed','Payment Pending','Processing','Cancelled','Delivery In Progres','Completed','Refunded') DEFAULT NULL,
  `bill_amount` decimal(10,2) DEFAULT NULL,
  `discount_perc` decimal(10,0) DEFAULT NULL,
  `promo_code` varchar(45) DEFAULT NULL,
  `tax_perc` decimal(3,2) DEFAULT NULL,
  `total_amount` decimal(10,2) DEFAULT NULL,
  `parent_order` int(11) DEFAULT NULL,
  `shipping_address` text,
  `latitude` decimal(12,8) DEFAULT NULL,
  `longitude` decimal(12,8) DEFAULT NULL,
  `city` text NOT NULL,
  `locality` text NOT NULL,
  `pincode` int(6) NOT NULL,
  `delivery_person` int(11) DEFAULT NULL,
  `delivery_time` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`order_id`),
  KEY `orders_user_id_fkey_idx` (`user_id`),
  KEY `orders_subscriptions_fkey_idx` (`plan_id`),
  KEY `orders_parent_order_fkey_idx` (`parent_order`),
  KEY `orders_delivery_person_fkey_idx` (`delivery_person`),
  CONSTRAINT `orders_delivery_person_fkey` FOREIGN KEY (`delivery_person`) REFERENCES `user_profiles` (`user_id`) ON UPDATE CASCADE,
  CONSTRAINT `orders_parent_order_fkey` FOREIGN KEY (`parent_order`) REFERENCES `orders` (`order_id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `orders_subscriptions_fkey` FOREIGN KEY (`plan_id`) REFERENCES `subscriptions` (`id`) ON UPDATE CASCADE,
  CONSTRAINT `orders_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `user_profiles` (`user_id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `orders`
--


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

CREATE TABLE `subscriptions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` enum('Group','Individual','Trial') NOT NULL,
  `plan_id` int(11) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `group_id` int(11) DEFAULT NULL,
  `duration` int(11) DEFAULT NULL,
  `start_date` date DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `status` enum('Pending','Payment Pending','Active','Cancelled','Completed') DEFAULT 'Pending',
  `order_dates` text,
  `load_default_cart` tinyint(1) DEFAULT '0',
  `set_default_cart` tinyint(1) DEFAULT '0',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `user_subscriptions_plan_id_fkey_idx` (`plan_id`),
  KEY `user_subscriptions_user_id_fkey_idx` (`user_id`),
  KEY `subscriptions_group_id_fkey` (`group_id`),
  CONSTRAINT `subscriptions_group_id_fkey` FOREIGN KEY (`group_id`) REFERENCES `user_groups` (`group_id`) ON UPDATE CASCADE,
  CONSTRAINT `subscriptions_plan_id_fkey` FOREIGN KEY (`plan_id`) REFERENCES `option_values` (`id`) ON UPDATE CASCADE,
  CONSTRAINT `subscriptions_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `user_profiles` (`user_id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `subscriptions`
--


--
-- Table structure for table `user_auth`
--

CREATE TABLE `user_auth` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `provider` varchar(255) NOT NULL,
  `provider_id` varchar(255) NOT NULL,
  `provider_attributes` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  KEY `user_auth_user_id_fkey` (`user_id`),
  CONSTRAINT `user_auth_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `user_auth`
--


--
-- Table structure for table `user_groups`
--

CREATE TABLE `user_groups` (
  `group_id` int(11) NOT NULL AUTO_INCREMENT,
  `group_leader` int(11) NOT NULL,
  `company_name` text NOT NULL,
  `company_address` text,
  `longitude` decimal(10,8) DEFAULT NULL,
  `latitude` decimal(10,8) DEFAULT NULL,
  `active` tinyint(4) NOT NULL DEFAULT '1',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`group_id`),
  KEY `subscription_groups_leader_fkey_idx` (`group_leader`),
  CONSTRAINT `subscription_groups_leader_fkey` FOREIGN KEY (`group_leader`) REFERENCES `user_profiles` (`user_id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `user_groups`
--


--
-- Table structure for table `user_profiles`
--

CREATE TABLE `user_profiles` (
  `user_id` int(11) NOT NULL,
  `full_name` text NOT NULL,
  `email_id` varchar(60) DEFAULT NULL,
  `mobile_number` varchar(15) DEFAULT NULL,
  `company_name` text NOT NULL,
  `company_address` text,
  `city` text,
  `locality` text,
  `latitude` decimal(12,8) DEFAULT NULL,
  `longitude` decimal(12,8) DEFAULT NULL,
  `pincode` int(6) DEFAULT NULL,
  `gender` enum('MALE','FEMALE') NOT NULL DEFAULT 'MALE',
  `date_of_birth` date DEFAULT NULL,
  `profile_pic` text,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `user_profiles_unique_email_key` (`email_id`),
  UNIQUE KEY `user_profiles_unique_mobile_key` (`mobile_number`),
  CONSTRAINT `user_profiles_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `user_profiles`
--

INSERT INTO `user_profiles` VALUES (1,'Kafekloud, Admin','admin@kafekloud.com','7674929003','KafeKloud Inc',NULL,NULL,NULL,NULL,NULL,560102,'MALE','1984-09-04',NULL,'2018-05-02 16:01:28',NULL);

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

CREATE TABLE `users` (
  `user_id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(60) DEFAULT NULL,
  `password` text NOT NULL,
  `otp_password` int(11) DEFAULT NULL,
  `reset_token` text,
  `user_role` enum('Customer','Admin','Employee','Delivery Boy') NOT NULL,
  `user_status` enum('Pending Approval','Inactive','Active') DEFAULT NULL,
  `access_token` text,
  `gcm_id` text,
  `last_login` timestamp NULL DEFAULT NULL,
  `user_meta` text,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `users_unique_username_key` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users`
--

INSERT INTO `users` VALUES (1,'admin@kafekloud.com','$2y$13$WcWSzjak.pEjG.CxnZbhPevnynBa3GYGTfZwONM07KPw1Kj1Nf4aO',NULL,NULL,'Admin','Active','a4f8tY7OXs_Juw64ek2XgPzAZ29lXn7Sgsfq0sX2unYnkrV2uKKLb9RCZW8CZpUZ',NULL,NULL,NULL,'2018-05-02 15:38:04',NULL);


