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




--
-- Database: `uipl_reclaimed`
--

DELIMITER $$
--
-- Procedures
--
CREATE DEFINER=`uipl`@`%` PROCEDURE `dumpSiteListAll` (IN `limitValue` INT(11), IN `offsetValue` INT(11))  BEGIN
SELECT `dump_site`.*, `ratingDetails`.`id` AS `ratingDetails.id`, `ratingDetails`.`to_id` AS `ratingDetails.to_id`, `ratingDetails`.`from_id` AS `ratingDetails.from_id`, `ratingDetails`.`type` AS `ratingDetails.type`, `ratingDetails`.`job_site_id` AS `ratingDetails.job_site_id`, `ratingDetails`.`rating` AS `ratingDetails.rating`, `ratingDetails`.`description` AS `ratingDetails.description`, `ratingDetails`.`is_deleted` AS `ratingDetails.is_deleted`, `ratingDetails`.`is_approved` AS `ratingDetails.is_approved`, `ratingDetails`.`created_at` AS `ratingDetails.created_at`, `ratingDetails`.`updated_at` AS `ratingDetails.updated_at` FROM (SELECT `dump_site`.`id`, `dump_site`.`user_id`, `dump_site`.`site_name`, `dump_site`.`description`, `dump_site`.`street`, `dump_site`.`city`, `dump_site`.`state`, `dump_site`.`zipcode`, `dump_site`.`direction_note`, `dump_site`.`phone_no`, `dump_site`.`primary_mobile_no`, `dump_site`.`secondary_mobile_no`, `dump_site`.`email`, `dump_site`.`website`, `dump_site`.`hours_of_operations`, `dump_site`.`driver_instructions`, `dump_site`.`quantity_required`, `dump_site`.`is_call_advance`, `dump_site`.`dump_location`, `dump_site`.`latitude`, `dump_site`.`longitude`, `dump_site`.`is_available`, `dump_site`.`is_deleted`, `dump_site`.`created_at`, `dump_site`.`updated_at` FROM `dump_site` AS `dump_site` WHERE `dump_site`.`is_deleted` = '0' LIMIT offsetValue, limitValue) AS `dump_site` LEFT OUTER JOIN `rating` AS `ratingDetails` ON `dump_site`.`id` = `ratingDetails`.`to_id`;
END$$

DELIMITER ;

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

--
-- Table structure for table `accepted_dump_materials`
--

CREATE TABLE `accepted_dump_materials` (
  `id` int(255) NOT NULL,
  `dump_id` int(255) NOT NULL,
  `material_id` int(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `appeared_in_search_analytics_driver`
--

CREATE TABLE `appeared_in_search_analytics_driver` (
  `id` int(11) NOT NULL,
  `searched_by` int(11) NOT NULL COMMENT 'user_id',
  `result_id` int(11) NOT NULL COMMENT 'driver_id',
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `appeared_in_search_analytics_dump_site`
--

CREATE TABLE `appeared_in_search_analytics_dump_site` (
  `id` int(11) NOT NULL,
  `searched_by` int(11) NOT NULL COMMENT 'user_id',
  `result_id` int(11) NOT NULL COMMENT 'dump_site_id',
  `owner_id` int(11) NOT NULL COMMENT 'contractor_id/material_customer_id',
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `appeared_in_search_analytics_job_site`
--

CREATE TABLE `appeared_in_search_analytics_job_site` (
  `id` int(11) NOT NULL,
  `searched_by` int(11) NOT NULL COMMENT 'user_id',
  `result_id` int(11) NOT NULL COMMENT 'job_site_id',
  `owner_id` int(11) NOT NULL COMMENT 'contractor_id',
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `calls_analytics`
--

CREATE TABLE `calls_analytics` (
  `id` int(11) NOT NULL,
  `to_id` int(11) NOT NULL,
  `from_id` int(11) NOT NULL,
  `status` enum('0','1') NOT NULL COMMENT '0 - missed, 1 - call made',
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `chat`
--

CREATE TABLE `chat` (
  `id` int(11) NOT NULL,
  `to_id` int(11) NOT NULL,
  `from_id` int(11) NOT NULL,
  `message_type` varchar(100) NOT NULL,
  `message` text NOT NULL,
  `is_read` enum('0','1') NOT NULL,
  `is_deleted` enum('0','1') NOT NULL,
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

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

CREATE TABLE `coupon` (
  `id` int(255) NOT NULL,
  `coupon_name` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  `coupon_code` varchar(255) NOT NULL,
  `expiry_date` date NOT NULL,
  `max_count` int(255) NOT NULL,
  `coupon_offer` int(11) NOT NULL COMMENT 'free (1=1 month,2=2 month,3=3 month)',
  `is_deleted` int(1) NOT NULL DEFAULT '0' COMMENT '0=not deleted,1=deleted'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `coupon`
--

INSERT INTO `coupon` (`id`, `coupon_name`, `description`, `coupon_code`, `expiry_date`, `max_count`, `coupon_offer`, `is_deleted`) VALUES
(1, 'coupon', 'using this code you use this app free for 3 month', '123456', '2018-01-31', 200, 3, 0);

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

--
-- Table structure for table `details_viewed_analytics`
--

CREATE TABLE `details_viewed_analytics` (
  `id` int(11) NOT NULL,
  `viewed_id` int(11) NOT NULL COMMENT 'details viewed of this id of type ...',
  `viewed_id_type` enum('dump_site','job_site','users') NOT NULL COMMENT 'viewed id type',
  `viewed_by` int(11) NOT NULL COMMENT 'Details viewed by',
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `devices`
--

CREATE TABLE `devices` (
  `id` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `token` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `regenerate_token` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `token_creation_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `token_expire_time` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `devices`
--

INSERT INTO `devices` (`id`, `uid`, `token`, `regenerate_token`, `token_creation_time`, `token_expire_time`) VALUES
(1, 1, '30311509965879', '', '2017-11-27 00:00:00', '0000-00-00 00:00:00'),
(2, 2, '48431511782095', '12721511782095', '2017-11-27 11:28:15', '2017-11-27 11:43:15');

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

--
-- Table structure for table `driver_preferences`
--

CREATE TABLE `driver_preferences` (
  `id` int(255) NOT NULL,
  `user_id` int(255) NOT NULL,
  `serve_area_zip_code` varchar(50) NOT NULL,
  `serve_area_latitude` decimal(10,8) NOT NULL,
  `serve_area_longitude` decimal(11,8) NOT NULL,
  `preferred_range` varchar(100) NOT NULL,
  `load_rate` decimal(18,2) NOT NULL,
  `hourly_rate` decimal(18,2) NOT NULL,
  `rate_per_ton` decimal(18,2) NOT NULL,
  `truck_make` varchar(255) NOT NULL,
  `truck_model` varchar(255) NOT NULL,
  `truck_year` varchar(10) NOT NULL,
  `truck_capacity` varchar(100) NOT NULL,
  `operation_hour` varchar(100) NOT NULL,
  `opening_time` time NOT NULL,
  `closing_time` time NOT NULL,
  `driver_preference_note` text NOT NULL,
  `driver_fee_note` text NOT NULL,
  `is_available` enum('0','1') NOT NULL DEFAULT '0' COMMENT '(Is driver available)0=not available 1=available',
  `is_assigned` enum('0','1') NOT NULL COMMENT '0=>not assigned, 1=>assigned',
  `is_redis_effected` enum('0','1') NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `driver_preference_materials`
--

CREATE TABLE `driver_preference_materials` (
  `id` int(255) NOT NULL,
  `driver_id` int(255) NOT NULL,
  `material_id` int(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Stand-in structure for view `dumpSiteAverageRating`
-- (See below for the actual view)
--
CREATE TABLE `dumpSiteAverageRating` (
`id` int(255)
,`to_id` int(255)
,`from_id` int(255)
,`average_rating` decimal(11,1)
,`type` enum('driver','job_site','dump_site')
,`job_site_id` int(255)
,`description` varchar(255)
,`created_at` datetime
,`updated_at` datetime
,`is_deleted` int(1)
,`is_approved` int(1)
);

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

--
-- Stand-in structure for view `dumpSiteDetails`
-- (See below for the actual view)
--
CREATE TABLE `dumpSiteDetails` (
`id` int(11)
,`user_id` int(11)
,`site_name` varchar(255)
,`description` varchar(255)
,`street` varchar(255)
,`city` varchar(255)
,`state` varchar(255)
,`zipcode` int(50)
,`direction_note` text
,`phone_no` varchar(255)
,`primary_mobile_no` varchar(255)
,`secondary_mobile_no` varchar(255)
,`email` varchar(255)
,`website` varchar(255)
,`hours_of_operations` enum('0','1')
,`driver_instructions` text
,`quantity_required` int(255)
,`is_call_advance` int(1)
,`dump_location` varchar(255)
,`latitude` varchar(255)
,`longitude` varchar(255)
,`is_available` enum('0','1','2')
,`is_deleted` int(1)
,`created_at` datetime
,`updated_at` datetime
,`averageRating` decimal(11,1)
);

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

--
-- Stand-in structure for view `dumpSiteListAllActive`
-- (See below for the actual view)
--
CREATE TABLE `dumpSiteListAllActive` (
`id` int(11)
,`user_id` int(11)
,`site_name` varchar(255)
,`description` varchar(255)
,`street` varchar(255)
,`city` varchar(255)
,`state` varchar(255)
,`zipcode` int(50)
,`direction_note` text
,`phone_no` varchar(255)
,`primary_mobile_no` varchar(255)
,`secondary_mobile_no` varchar(255)
,`email` varchar(255)
,`website` varchar(255)
,`hours_of_operations` enum('0','1')
,`driver_instructions` text
,`quantity_required` int(255)
,`is_call_advance` int(1)
,`dump_location` varchar(255)
,`latitude` varchar(255)
,`longitude` varchar(255)
,`is_available` enum('0','1','2')
,`is_deleted` int(1)
,`created_at` datetime
,`updated_at` datetime
);

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

--
-- Table structure for table `dump_site`
--

CREATE TABLE `dump_site` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `site_name` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  `street` varchar(255) NOT NULL,
  `city` varchar(255) NOT NULL,
  `state` varchar(255) NOT NULL,
  `zipcode` int(50) NOT NULL,
  `direction_note` text NOT NULL,
  `phone_no` varchar(255) NOT NULL,
  `primary_mobile_no` varchar(255) NOT NULL,
  `secondary_mobile_no` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `website` varchar(255) NOT NULL,
  `hours_of_operations` enum('0','1') NOT NULL COMMENT '(Is Open For 24X7?) open 24X7 - true(1),open 24X7 - false(0)',
  `driver_instructions` text NOT NULL,
  `quantity_required` int(255) NOT NULL,
  `is_call_advance` int(1) NOT NULL DEFAULT '1' COMMENT '1=yes,0=no',
  `dump_location` varchar(255) NOT NULL,
  `latitude` varchar(255) NOT NULL,
  `longitude` varchar(255) NOT NULL,
  `is_available` enum('0','1','2') NOT NULL DEFAULT '1' COMMENT '0-unavailable,1-available,1-future',
  `is_deleted` int(1) NOT NULL DEFAULT '0' COMMENT '1=deleted,0=undeleted',
  `is_redis_effected` enum('0','1') NOT NULL COMMENT '0->not effected, 1->effected',
  `appeared_in_search_count` bigint(20) NOT NULL,
  `details_viewed_count` bigint(20) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `dump_site_timing`
--

CREATE TABLE `dump_site_timing` (
  `id` int(11) NOT NULL,
  `dump_site_id` int(11) NOT NULL,
  `day` int(11) NOT NULL COMMENT '0: ''Sunday'',         	1: ''Monday'',        	2: ''Tuesday'',         	3: ''Wednesday'',         	4: ''Thursday'',         	5: ''Friday'',         	6: ''Saturday''',
  `is_open` varchar(50) NOT NULL COMMENT 'true/false',
  `open_from` time NOT NULL,
  `open_to` time NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `favourites`
--

CREATE TABLE `favourites` (
  `id` int(11) NOT NULL,
  `reference_id` int(11) NOT NULL COMMENT 'either job_site_id or dump_site_id or user_id according to reference_id_type',
  `reference_id_type` enum('dump_site','job_site','users') NOT NULL,
  `user_id` int(11) NOT NULL COMMENT 'who''s favourite',
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `fees`
--

CREATE TABLE `fees` (
  `id` int(255) NOT NULL,
  `monthly_fee` double(10,2) NOT NULL,
  `yearly_fee` double(10,2) NOT NULL,
  `is_deleted` int(1) NOT NULL DEFAULT '0' COMMENT '0=undeleted, 1=deleted'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `forgot_password_requests`
--

CREATE TABLE `forgot_password_requests` (
  `id` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `reference_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Table structure for table `image`
--

CREATE TABLE `image` (
  `id` int(255) NOT NULL,
  `job_site_id` int(255) NOT NULL,
  `dump_site_id` int(255) NOT NULL,
  `image` varchar(255) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='DUMP SITE AND JOB SITE IMAGE';

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

--
-- Table structure for table `job_site`
--

CREATE TABLE `job_site` (
  `id` int(255) NOT NULL,
  `contractor_id` int(255) NOT NULL,
  `site_name` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `street` varchar(255) NOT NULL,
  `city` varchar(255) NOT NULL,
  `state` varchar(255) NOT NULL,
  `zipcode` int(50) NOT NULL,
  `direction_note` text NOT NULL,
  `phone_no` varchar(20) NOT NULL,
  `primary_mobile_no` varchar(20) NOT NULL,
  `secondary_mobile_no` varchar(20) NOT NULL,
  `email` varchar(255) NOT NULL,
  `website` varchar(255) NOT NULL,
  `project_start_date` date NOT NULL,
  `project_end_date` date NOT NULL,
  `drivers_needed` enum('0','1') NOT NULL DEFAULT '1',
  `total_truk_driver` int(255) NOT NULL,
  `driver_instructions` text NOT NULL,
  `latitude` varchar(255) NOT NULL,
  `longitude` varchar(255) NOT NULL,
  `site_image` varchar(255) NOT NULL,
  `is_available` enum('0','1') NOT NULL DEFAULT '1' COMMENT '1=available,0=unavailable',
  `is_deleted` enum('0','1') NOT NULL DEFAULT '0' COMMENT '1=deleted,0=undeleted',
  `is_redis_effected` enum('0','1') NOT NULL COMMENT '0->not effected, 1->effected',
  `appeared_in_search_count` bigint(20) NOT NULL,
  `details_viewed_count` bigint(20) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `job_site_to_driver`
--

CREATE TABLE `job_site_to_driver` (
  `id` int(11) NOT NULL,
  `job_site_id` int(11) NOT NULL,
  `driver_id` int(11) NOT NULL COMMENT 'user_id',
  `is_removed` enum('0','1') NOT NULL DEFAULT '0' COMMENT '1 - removed, 0- not removed',
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `lead`
--

CREATE TABLE `lead` (
  `id` int(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `type` int(1) NOT NULL DEFAULT '1' COMMENT '1=job site,2=dump site,3=driver',
  `note` text NOT NULL,
  `street` varchar(255) NOT NULL,
  `city` varchar(255) NOT NULL,
  `state` varchar(255) NOT NULL,
  `zip_code` varchar(255) NOT NULL,
  `contact_person_name` varchar(255) NOT NULL,
  `contact_person_no` varchar(255) NOT NULL,
  `status` enum('1','2','3') NOT NULL DEFAULT '1' COMMENT '1=open,2=in progress,3=close',
  `created_at` datetime NOT NULL,
  `created_by` int(11) NOT NULL,
  `is_deleted` int(1) NOT NULL DEFAULT '1' COMMENT '1=deleted,0=undeleted',
  `is_redis_effected` enum('0','1') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `master_reference_code`
--

CREATE TABLE `master_reference_code` (
  `id` int(255) NOT NULL,
  `max_uses` int(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `master_reference_code`
--

INSERT INTO `master_reference_code` (`id`, `max_uses`) VALUES
(1, 50);

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

--
-- Table structure for table `materials`
--

CREATE TABLE `materials` (
  `id` int(255) NOT NULL,
  `material_name` varchar(255) NOT NULL,
  `is_deleted` int(1) NOT NULL DEFAULT '0' COMMENT '1=deleted,0=not deleted'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `materials`
--

INSERT INTO `materials` (`id`, `material_name`, `is_deleted`) VALUES
(1, 'Asphalt', 0),
(2, 'Concrete', 0),
(3, 'Clean Fill', 0),
(4, 'Millings', 0),
(5, 'Stone', 0),
(6, 'Top Soil', 0);

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

--
-- Table structure for table `otp`
--

CREATE TABLE `otp` (
  `id` int(255) NOT NULL,
  `user_id` int(255) NOT NULL,
  `country_code` int(5) NOT NULL,
  `phone_no` varchar(20) NOT NULL COMMENT 'primary_mobile_no',
  `email` varchar(255) NOT NULL,
  `type` enum('1','2') NOT NULL DEFAULT '1' COMMENT '1=registration,2=forgot password',
  `otp` int(10) NOT NULL,
  `token` varchar(100) NOT NULL,
  `created_at` datetime NOT NULL,
  `expire_date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `otp`
--

INSERT INTO `otp` (`id`, `user_id`, `country_code`, `phone_no`, `email`, `type`, `otp`, `token`, `created_at`, `expire_date`) VALUES
(1, 2, 91, '7501500090', 'sambaran.unified@gmail.com', '1', 137, '', '2017-11-27 11:28:08', '2017-11-27 11:58:08');

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

--
-- Table structure for table `plan`
--

CREATE TABLE `plan` (
  `id` int(11) NOT NULL,
  `plan_name` varchar(255) NOT NULL,
  `amount` double(10,2) NOT NULL,
  `is_valid` int(10) NOT NULL COMMENT 'value in days',
  `is_deleted` int(1) NOT NULL DEFAULT '0' COMMENT '1=deleted,0=undeleted',
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `plan`
--

INSERT INTO `plan` (`id`, `plan_name`, `amount`, `is_valid`, `is_deleted`, `created_at`, `updated_at`) VALUES
(1, 'monthly', 49.95, 30, 0, '2017-10-12 00:00:00', '0000-00-00 00:00:00'),
(2, 'annual', 539.45, 365, 0, '2017-10-12 00:00:00', '0000-00-00 00:00:00');

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

--
-- Table structure for table `pre_payment`
--

CREATE TABLE `pre_payment` (
  `id` int(255) NOT NULL,
  `user_id` int(255) NOT NULL,
  `user_name` varchar(255) NOT NULL,
  `email` varchar(100) NOT NULL,
  `phone_no` varchar(20) NOT NULL,
  `plan_id` int(255) NOT NULL,
  `status` enum('0','1') NOT NULL DEFAULT '0' COMMENT '1=payment success',
  `date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `rating`
--

CREATE TABLE `rating` (
  `id` int(255) NOT NULL,
  `to_id` int(255) NOT NULL COMMENT 'user_id',
  `from_id` int(255) NOT NULL,
  `type` enum('driver','job_site','dump_site') NOT NULL,
  `job_site_id` int(255) NOT NULL,
  `rating` decimal(10,1) NOT NULL,
  `description` varchar(255) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `is_deleted` int(1) NOT NULL DEFAULT '1' COMMENT '1=deleted,0=undeleted',
  `is_approved` int(1) NOT NULL DEFAULT '1' COMMENT '1=approved,0=disapproved'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `sitesettings`
--

CREATE TABLE `sitesettings` (
  `id` int(11) NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `display_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `value` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `validation_rules` text COLLATE utf8_unicode_ci NOT NULL,
  `validation_regex_php` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `sitesettings`
--

INSERT INTO `sitesettings` (`id`, `name`, `display_name`, `type`, `value`, `validation_rules`, `validation_regex_php`) VALUES
(1, 'email', 'From which email do you want to send your appication emails?', 'text', 'snehadeep.unified@gmail.com', 'validate[required,custom[email]]', '^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$'),
(2, 'phone_no', 'From which phone number do you want to send your appication SMS?', 'text', '+1 585-598-9778', 'validate[required]', ''),
(3, 'twilio_sid', 'Twilio Sid', 'text', 'ACea72b192ee9f2a60b0641064522fc6c6', 'validate[required]', ''),
(4, 'twilio_secret_id', 'Twilio Secret Id', 'text', '7cb9e6d26db6ac701a71576ddd6fd4de', 'validate[required]', ''),
(5, 'max_job_site', 'Facebook link', 'text', '200', 'validate[required]', ''),
(6, 'max_dump_site', 'Linked In link', 'text', '200', 'validate[required]', ''),
(7, 'dump_site_list_default_radius', 'Dump Site List Default Radius', 'text', '5000', 'validate[required]', ''),
(8, 'truck_driver_list_default_radius', 'Truck Driver List Default Radius', 'text', '25', 'validate[required]', ''),
(9, 'dump_site_list_max_radius', 'Dump Site List Max Radius', 'text', '10000', 'validate[required]', ''),
(10, 'dump_site_list_min_radius', 'Dump Site List Min Radius', 'text', '0', 'validate[required]', ''),
(11, 'driver_list_default_radius', 'Driver List Default Radius', 'text', '5000', 'validate[required]', ''),
(12, 'driver_list_min_radius', 'Driver List Min Radius', 'text', '0', 'validate[required]', ''),
(13, 'driver_list_max_radius', 'Driver List Max Radius', 'text', '10000', 'validate[required]', ''),
(14, 'job_site_list_default_radius', 'Job Site List Default Radius', 'text', '5000', 'validate[required]', ''),
(15, 'job_site_list_min_radius', 'Job Site List Min Radius', 'text', '0', 'validate[required]', ''),
(16, 'job_site_list_max_radius', 'Job Site List Max Radius', 'text', '10000', 'validate[required]', '');

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

--
-- Table structure for table `transaction`
--

CREATE TABLE `transaction` (
  `id` int(255) NOT NULL,
  `user_id` int(255) NOT NULL,
  `transaction_id` int(255) NOT NULL,
  `payment_date` date NOT NULL,
  `amount` double(10,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

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

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `parent_id` int(11) NOT NULL COMMENT 'parent_user(applied for associated drivers)',
  `role` int(11) NOT NULL DEFAULT '0' COMMENT '1 ==> superadmin, 2==>contractor, 3 ==> driver, 4 ==> Material Customer',
  `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `password` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `first_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `last_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `gender` enum('male','female') COLLATE utf8_unicode_ci NOT NULL,
  `address` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `city` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `state` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `zip_code` int(20) DEFAULT NULL,
  `country_code` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `phone_no` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
  `primary_mobile_no` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
  `secondary_mobile_no` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `dob` date NOT NULL,
  `profile_image` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `latitude` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  `longitude` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  `organisation` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `total_strength` int(255) NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `is_deleted` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0' COMMENT '1=deleted,0=undeleted',
  `remember_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `device_type` enum('1','2','3') COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '1=>android,2=>ios,3=>web',
  `device_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `login_type` enum('0','1','2') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0' COMMENT '0=>normal,1=>google,2=>facebook',
  `is_active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0' COMMENT '1=active,0=deactive',
  `is_phone_no_verified` enum('0','1') COLLATE utf8_unicode_ci NOT NULL COMMENT 'is primary phone number verified(0->not verified, 1->verified)',
  `is_redis_effected` enum('0','1') COLLATE utf8_unicode_ci NOT NULL COMMENT '0->not effected, 1->effected',
  `appeared_in_search_count` bigint(20) NOT NULL,
  `details_viewed_count` bigint(20) NOT NULL,
  `hourly_rate` decimal(10,2) DEFAULT '0.00',
  `master_reference_code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `coupon_code` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `expire_date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `users` (`id`, `parent_id`, `role`, `email`, `password`, `first_name`, `last_name`, `gender`, `address`, `city`, `state`, `zip_code`, `country_code`, `phone_no`, `primary_mobile_no`, `secondary_mobile_no`, `dob`, `profile_image`, `latitude`, `longitude`, `organisation`, `total_strength`, `created_by`, `updated_by`, `created_at`, `updated_at`, `is_deleted`, `remember_token`, `device_type`, `device_id`, `login_type`, `is_active`, `is_phone_no_verified`, `is_redis_effected`, `appeared_in_search_count`, `details_viewed_count`, `hourly_rate`, `master_reference_code`, `coupon_code`, `expire_date`) VALUES
(1, 0, 1, 'super_admin@gmail.com', '$2y$10$JvIC83oWoCE5U842Pwqm6OWoxdaakCy3YlhqiLAfICgy7OJvD9vQi', 'Super', 'Admin', 'male', 'Durganagar', 'Kolkata', 'westbengal', 7432110, '+91', '', '9051922235', '', '1992-10-09', 'nopicture.png', '22.5748889', '88.36885269999999', 'uipl', 100, 0, 0, '2017-11-06 10:49:11', '2017-11-06 10:49:11', '0', NULL, '2', '1234', '0', '1', '0', '1', 0, 0, '20.00', '', '', '2019-10-31'),
(2, 0, 2, 'sambaran.unified@gmail.com', '$2y$10$hjy.bbvkOJL7lbhBWLXKiuwE.i0vb06R.M7vT/i/dP6A5OcVpNox2', 'sambaran', 'Das', 'male', 'saltlake', 'kolkata', 'westbengal', 700091, '91', '7501500090', '7501500090', '', '0000-00-00', 'nopicture.png', '22.580756', '88.465698', 'uipl', 0, 0, 0, '2017-11-27 11:28:06', '2017-11-27 11:28:06', '0', NULL, '2', '0EBFE379-2C3A-4D58-BC39-A7AB7E1940C6', '0', '1', '1', '1', 0, 0, '0.00', 'AZDw2FDJex', '123456', '2018-02-25');

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

--
-- Table structure for table `user_card_details`
--

CREATE TABLE `user_card_details` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `card_number` varchar(20) NOT NULL,
  `name_on_card` varchar(255) NOT NULL,
  `card_type` enum('0','1') DEFAULT NULL COMMENT '0=credit card,1=debit card',
  `is_primary` int(1) NOT NULL COMMENT '1 ====> Primary, 0 ===> Secondry',
  `is_deleted` int(1) NOT NULL DEFAULT '0' COMMENT '1=delete,0=undelete',
  `created_at` datetime NOT NULL,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `user_plan`
--

CREATE TABLE `user_plan` (
  `id` int(255) NOT NULL,
  `user_id` int(255) NOT NULL,
  `plan_id` int(255) NOT NULL,
  `transaction_id` int(255) NOT NULL,
  `expire_on` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Structure for view `dumpSiteAverageRating`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`uipl`@`%` SQL SECURITY DEFINER VIEW `dumpSiteAverageRating`  AS  select `rating`.`id` AS `id`,`rating`.`to_id` AS `to_id`,`rating`.`from_id` AS `from_id`,round(avg(`rating`.`rating`),1) AS `average_rating`,`rating`.`type` AS `type`,`rating`.`job_site_id` AS `job_site_id`,`rating`.`description` AS `description`,`rating`.`created_at` AS `created_at`,`rating`.`updated_at` AS `updated_at`,`rating`.`is_deleted` AS `is_deleted`,`rating`.`is_approved` AS `is_approved` from `rating` where ((`rating`.`is_deleted` = '0') and (`rating`.`is_approved` = '1') and (`rating`.`type` = 'dump_site')) group by `rating`.`to_id` ;

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

--
-- Structure for view `dumpSiteDetails`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`uipl`@`%` SQL SECURITY DEFINER VIEW `dumpSiteDetails`  AS  select `dump_site`.`id` AS `id`,`dump_site`.`user_id` AS `user_id`,`dump_site`.`site_name` AS `site_name`,`dump_site`.`description` AS `description`,`dump_site`.`street` AS `street`,`dump_site`.`city` AS `city`,`dump_site`.`state` AS `state`,`dump_site`.`zipcode` AS `zipcode`,`dump_site`.`direction_note` AS `direction_note`,`dump_site`.`phone_no` AS `phone_no`,`dump_site`.`primary_mobile_no` AS `primary_mobile_no`,`dump_site`.`secondary_mobile_no` AS `secondary_mobile_no`,`dump_site`.`email` AS `email`,`dump_site`.`website` AS `website`,`dump_site`.`hours_of_operations` AS `hours_of_operations`,`dump_site`.`driver_instructions` AS `driver_instructions`,`dump_site`.`quantity_required` AS `quantity_required`,`dump_site`.`is_call_advance` AS `is_call_advance`,`dump_site`.`dump_location` AS `dump_location`,`dump_site`.`latitude` AS `latitude`,`dump_site`.`longitude` AS `longitude`,`dump_site`.`is_available` AS `is_available`,`dump_site`.`is_deleted` AS `is_deleted`,`dump_site`.`created_at` AS `created_at`,`dump_site`.`updated_at` AS `updated_at`,(case when isnull(`dumpSiteAverageRating`.`average_rating`) then 0 else `dumpSiteAverageRating`.`average_rating` end) AS `averageRating` from (`dumpSiteListAllActive` `dump_site` left join `dumpSiteAverageRating` on((`dump_site`.`id` = `dumpSiteAverageRating`.`to_id`))) ;

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

--
-- Structure for view `dumpSiteListAllActive`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`uipl`@`%` SQL SECURITY DEFINER VIEW `dumpSiteListAllActive`  AS  select `dump_site`.`id` AS `id`,`dump_site`.`user_id` AS `user_id`,`dump_site`.`site_name` AS `site_name`,`dump_site`.`description` AS `description`,`dump_site`.`street` AS `street`,`dump_site`.`city` AS `city`,`dump_site`.`state` AS `state`,`dump_site`.`zipcode` AS `zipcode`,`dump_site`.`direction_note` AS `direction_note`,`dump_site`.`phone_no` AS `phone_no`,`dump_site`.`primary_mobile_no` AS `primary_mobile_no`,`dump_site`.`secondary_mobile_no` AS `secondary_mobile_no`,`dump_site`.`email` AS `email`,`dump_site`.`website` AS `website`,`dump_site`.`hours_of_operations` AS `hours_of_operations`,`dump_site`.`driver_instructions` AS `driver_instructions`,`dump_site`.`quantity_required` AS `quantity_required`,`dump_site`.`is_call_advance` AS `is_call_advance`,`dump_site`.`dump_location` AS `dump_location`,`dump_site`.`latitude` AS `latitude`,`dump_site`.`longitude` AS `longitude`,`dump_site`.`is_available` AS `is_available`,`dump_site`.`is_deleted` AS `is_deleted`,`dump_site`.`created_at` AS `created_at`,`dump_site`.`updated_at` AS `updated_at` from `dump_site` where (`dump_site`.`is_deleted` = '0') ;

--
-- Indexes for dumped tables
--

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `accepted_dump_materials`
--
ALTER TABLE `accepted_dump_materials`
  MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `appeared_in_search_analytics_driver`
--
ALTER TABLE `appeared_in_search_analytics_driver`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `appeared_in_search_analytics_dump_site`
--
ALTER TABLE `appeared_in_search_analytics_dump_site`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `appeared_in_search_analytics_job_site`
--
ALTER TABLE `appeared_in_search_analytics_job_site`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `calls_analytics`
--
ALTER TABLE `calls_analytics`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `chat`
--
ALTER TABLE `chat`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `coupon`
--
ALTER TABLE `coupon`
  MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `details_viewed_analytics`
--
ALTER TABLE `details_viewed_analytics`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `devices`
--
ALTER TABLE `devices`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `driver_preferences`
--
ALTER TABLE `driver_preferences`
  MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `driver_preference_materials`
--
ALTER TABLE `driver_preference_materials`
  MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `dump_site`
--
ALTER TABLE `dump_site`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `dump_site_timing`
--
ALTER TABLE `dump_site_timing`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `favourites`
--
ALTER TABLE `favourites`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `fees`
--
ALTER TABLE `fees`
  MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `forgot_password_requests`
--
ALTER TABLE `forgot_password_requests`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `image`
--
ALTER TABLE `image`
  MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `job_site`
--
ALTER TABLE `job_site`
  MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `job_site_to_driver`
--
ALTER TABLE `job_site_to_driver`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `lead`
--
ALTER TABLE `lead`
  MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `master_reference_code`
--
ALTER TABLE `master_reference_code`
  MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `materials`
--
ALTER TABLE `materials`
  MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `otp`
--
ALTER TABLE `otp`
  MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `plan`
--
ALTER TABLE `plan`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `pre_payment`
--
ALTER TABLE `pre_payment`
  MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `rating`
--
ALTER TABLE `rating`
  MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sitesettings`
--
ALTER TABLE `sitesettings`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT for table `transaction`
--
ALTER TABLE `transaction`
  MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `user_card_details`
--
ALTER TABLE `user_card_details`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user_plan`
--
ALTER TABLE `user_plan`
  MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
DELIMITER $$
--
-- Events
--
CREATE DEFINER=`uipl`@`%` EVENT `make_driver_unavailable` ON SCHEDULE EVERY 24 HOUR STARTS '2017-11-23 11:59:00' ON COMPLETION NOT PRESERVE ENABLE COMMENT 'Make driver unavailable every end of the day' DO UPDATE driver_preferences SET driver_preferences.is_available = '0' WHERE driver_preferences.id > 0$$

DELIMITER ;

