INSERT INTO `users` (`id`, `first_name`, `last_name`, `gender`, `cnic`, `email`, `designation`, `department`, `user_type`, `files_1`, `name`, `password`, `pin_code`, `isp`, `mobile`, `sms`, `dt`, `del`, `lead_status`) VALUES
(199, 'Arham', 'Ali', 'male', '36302-3444344-7', 'arhamali@elaan.net', 'Manager Sales', 'Sales', 'standard', 'data:image/jpeg;base64,[encoded data, 21632 characters]', 'arhamali', 'd9e0db79b1f4aa72d69204305ee13160', '', 'Telenor', '03457327739', 'Y', '0000-00-00 00:00:00', 'N', 'Y'),
(200, 'Maria', 'Zafar', 'female', '37203-0934254-6', 'salescoordinator@elaan.net', 'Manager Sales', 'Sales', 'accounts', 'data:image/jpeg;base64,[encoded data, 21632 characters]', 'mariazafar', 'a32f33e19e8cddcbb4fa1cba131d023f', '', 'Telenor', '03055993140', 'N', '0000-00-00 00:00:00', 'N', 'N');
INSERT INTO `users` (`id`, `first_name`, `last_name`, `gender`, `cnic`, `email`, `designation`, `department`, `user_type`, `files_1`, `name`, `password`, `pin_code`, `isp`, `mobile`, `sms`, `dt`, `del`, `lead_status`) VALUES
(202, 'Saif', 'Ul Islam', 'Male', '-', 'mirzasaif998@gmail.com', 'Manager Sales', 'Sales', 'accounts', 'data:image/jpeg;base64,[encoded data, 21632 characters]', 'saifulislam', '33b991f2640e764fb6a08d367a7f8b01', '', 'Telenor', '03125922116', 'N', '0000-00-00 00:00:00', 'N', 'N'),
(203, 'Lead', 'Dump', 'Male', '', 'leaddump@elaanmarketing.com', 'Manager Sales', 'Sales', 'admin', 'data:image/jpeg;base64,[encoded data, 21632 characters]', 'leaddump', '39d0f69a4b8b7555fcf4356ebb3aa201', '', 'Telenor', '03054785597', 'Y', '0000-00-00 00:00:00', 'N', 'N');
INSERT INTO `users` (`id`, `first_name`, `last_name`, `gender`, `cnic`, `email`, `designation`, `department`, `user_type`, `files_1`, `name`, `password`, `pin_code`, `isp`, `mobile`, `sms`, `dt`, `del`, `lead_status`) VALUES
(204, 'Mohsin', 'Iqbal', 'male', '61101-9349629-9', 'mohsiniqbal@elaan.net', 'Manager Sales', 'Sales', 'standard', 'data:image/jpeg;base64,[encoded data, 21632 characters]', 'mohsiniqbal', 'f8d3621d412d6baaa8f3975f802c6458', '', 'Telenor', '03457321473', 'Y', '0000-00-00 00:00:00', 'N', 'Y'),
(205, 'Mudassir', 'Nawaz', 'male', '37405-5020299-9', 'mudassirnawaz@elaan.net', 'Manager Sales', 'Sales', 'standard', 'data:image/jpeg;base64,[encoded data, 21632 characters]', 'mudassirnawaz', '00bfcf06e6dd953e2fd3e0b0840cdbea', '', 'Telenor', '03457324084', 'Y', '0000-00-00 00:00:00', 'N', 'Y');
INSERT INTO `users` (`id`, `first_name`, `last_name`, `gender`, `cnic`, `email`, `designation`, `department`, `user_type`, `files_1`, `name`, `password`, `pin_code`, `isp`, `mobile`, `sms`, `dt`, `del`, `lead_status`) VALUES
(206, 'Zeeshan', 'Akhtar', 'Male', '45504-7319416-1', 'zeeshan@elaan.net', 'Assistant Director Sales', 'Sales', 'director', 'data:image/jpeg;base64,[encoded data, 21632 characters]', 'zeeshanakhtar', 'fa05541dc41973d21543ab2c7d2b99dd', '', 'Telenor', '03457280480', 'Y', '2023-07-21 13:07:29', 'N', 'N'),
(208, 'Abdul', 'Mateen', 'Male', '37406-5058663-3', 'walnwac.graphics@gmail.com', 'Digital Marketing Manager', 'Digital Marketing', 'user', 'data:image/jpeg;base64,[encoded data, 21632 characters]\r\n\r\n', 'abdulmateen', '8f645a5bdbf9b0b975e257a4dce34cef', '', 'Telenor', '03054785597', 'Y', '0000-00-00 00:00:00', 'N', 'N');
INSERT INTO `users` (`id`, `first_name`, `last_name`, `gender`, `cnic`, `email`, `designation`, `department`, `user_type`, `files_1`, `name`, `password`, `pin_code`, `isp`, `mobile`, `sms`, `dt`, `del`, `lead_status`) VALUES
(209, 'hehehehehe', 'hahahhaa', 'Female', '65656-5656565-6', '213@gmail.com', 'Assistant Director Sales', 'Sales', 'user', 'data:image/jpeg;base64,[encoded data, 21632 characters]\r\n\r\n', 'user4', 'd2a078886e69ee7838c31cf7ee513acf', '', 'Telenor', '03565656656', 'Y', '0000-00-00 00:00:00', 'N', 'N');

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

--
-- Table structure for table `users_contracts`
--

CREATE TABLE IF NOT EXISTS `users_contracts` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `contract_type` varchar(50) NOT NULL,
  `contract_duration` varchar(20) NOT NULL,
  `probation_status` varchar(1) NOT NULL DEFAULT 'N',
  `probation_duration` varchar(20) NOT NULL,
  `allocated_leaves` int NOT NULL,
  `doj` varchar(20) NOT NULL,
  `dir` varchar(50) NOT NULL DEFAULT 'employee_contracts',
  `offer_letter` varchar(150) NOT NULL,
  `page_count` varchar(15) NOT NULL,
  `dt` varchar(20) NOT NULL,
  `del` varchar(1) NOT NULL DEFAULT 'N',
  `user` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `user` (`user`),
  KEY `contract_type` (`contract_type`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users_contracts`
--

INSERT INTO `users_contracts` (`id`, `user_id`, `contract_type`, `contract_duration`, `probation_status`, `probation_duration`, `allocated_leaves`, `doj`, `dir`, `offer_letter`, `page_count`, `dt`, `del`, `user`) VALUES
(1, 54, 'Full Time', '3', 'y', '20 Days', 20, '07/13/2023', 'employee_contracts', 'offer_letter_userid_54.pdf', '3 Pages', '1690318346', 'N', 'ehtesham'),
(2, 1, 'Full Time', '40', 'y', '85', 40, '07/27/2023', 'employee_contracts', 'offer_letter_userid_101.pdf', '1 Page', '1696253062', 'N', 'ehtesham');

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

--
-- Table structure for table `users_contracts_types`
--

CREATE TABLE IF NOT EXISTS `users_contracts_types` (
  `id` int NOT NULL AUTO_INCREMENT,
  `type` varchar(50) NOT NULL,
  `del` varchar(1) NOT NULL DEFAULT 'N',
  PRIMARY KEY (`id`),
  KEY `type` (`type`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users_contracts_types`
--

INSERT INTO `users_contracts_types` (`id`, `type`, `del`) VALUES
(1, 'Full Time', 'N'),
(2, 'Part Time', 'N'),
(3, 'Freelance', 'N');

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

--
-- Table structure for table `users_departments`
--

CREATE TABLE IF NOT EXISTS `users_departments` (
  `id` int NOT NULL AUTO_INCREMENT,
  `department` varchar(150) NOT NULL,
  `budget` int NOT NULL,
  `department_head` int NOT NULL,
  `dt` varchar(20) NOT NULL,
  `del` varchar(1) NOT NULL DEFAULT 'N',
  `user` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user` (`user`),
  KEY `department_head` (`department_head`),
  KEY `department` (`department`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users_departments`
--

INSERT INTO `users_departments` (`id`, `department`, `budget`, `department_head`, `dt`, `del`, `user`) VALUES
(1, 'Sales', 0, 206, '1688484513', 'N', 'ehtesham'),
(2, 'Digital Marketing', 0, 54, '1696664808', 'N', 'ehtesham'),
(5, 'Elaan Productions', 500000, 0, '1700064647', 'N', 'ehtesham');

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

--
-- Table structure for table `users_designations`
--

CREATE TABLE IF NOT EXISTS `users_designations` (
  `id` int NOT NULL AUTO_INCREMENT,
  `designation` varchar(150) NOT NULL,
  `departments` varchar(50) NOT NULL,
  `sort` int NOT NULL,
  `dt` varchar(20) NOT NULL,
  `del` varchar(1) NOT NULL DEFAULT 'N',
  `user` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user` (`user`),
  KEY `designation` (`designation`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users_designations`
--

INSERT INTO `users_designations` (`id`, `designation`, `departments`, `sort`, `dt`, `del`, `user`) VALUES
(1, 'Manager Sales', '1', 1, '1688484513', 'N', 'ehtesham'),
(2, 'Digital Marketing Strategist', '2', 1, '1688484513', 'N', 'ehtesham'),
(3, 'Content Writer', '2', 2, '1688484513', 'N', 'ehtesham'),
(4, 'Digital Marketing Manager', '2', 0, '1688484513', 'N', 'ehtesham'),
(5, 'Assistant Director Sales', '1', 0, '1688484513', 'N', 'ehtesham');

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

--
-- Table structure for table `users_details`
--

CREATE TABLE IF NOT EXISTS `users_details` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `dob` varchar(20) NOT NULL,
  `address` text NOT NULL,
  `city` varchar(50) NOT NULL,
  `whatsapp` varchar(20) NOT NULL,
  `instagram` varchar(250) NOT NULL,
  `twitter` varchar(250) NOT NULL,
  `facebook` varchar(250) NOT NULL,
  `linkedin` varchar(250) NOT NULL,
  `del` varchar(1) NOT NULL DEFAULT 'N',
  `dt` varchar(20) NOT NULL,
  `user` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `user` (`user`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users_details`
--

INSERT INTO `users_details` (`id`, `user_id`, `dob`, `address`, `city`, `whatsapp`, `instagram`, `twitter`, `facebook`, `linkedin`, `del`, `dt`, `user`) VALUES
(4, 54, '09/21/1996', 'Office # 1, Second floor, Gulberg Trade Center, Gulberg Greens', 'Hunza Nagar', '03085602470', 'instagram.com/hannan', 'twitter.com/hannan', 'facebook.com/hannan', 'linkedin.com/hannan', 'N', '1690318381', 'ehtesham');

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

--
-- Table structure for table `users_genders`
--

CREATE TABLE IF NOT EXISTS `users_genders` (
  `id` int NOT NULL AUTO_INCREMENT,
  `gender` varchar(50) NOT NULL,
  `sort` int NOT NULL,
  `del` varchar(1) NOT NULL DEFAULT 'N',
  `dt` varchar(20) NOT NULL,
  `user` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user` (`user`),
  KEY `gender` (`gender`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users_genders`
--

INSERT INTO `users_genders` (`id`, `gender`, `sort`, `del`, `dt`, `user`) VALUES
(1, 'Male', 1, 'N', '1689855112', 'ehtesham'),
(2, 'Female', 2, 'N', '1689855112', 'ehtesham');

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

--
-- Table structure for table `users_jobs`
--

CREATE TABLE IF NOT EXISTS `users_jobs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `offices` varchar(100) NOT NULL,
  `day_off` varchar(50) NOT NULL,
  `time_in` varchar(20) NOT NULL,
  `time_out` varchar(20) NOT NULL,
  `dt` varchar(20) NOT NULL,
  `del` varchar(1) NOT NULL DEFAULT 'N',
  `user` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `user` (`user`),
  KEY `day_off` (`day_off`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users_jobs`
--

INSERT INTO `users_jobs` (`id`, `user_id`, `offices`, `day_off`, `time_in`, `time_out`, `dt`, `del`, `user`) VALUES
(1, 206, '2,1', 'Sunday', '10:30 AM', '19:30 PM', '1690283637', 'N', 'ehtesham'),
(2, 54, '1', 'Sunday', '10:30 AM', '19:30 PM', '1690317500', 'N', 'ehtesham');

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

--
-- Table structure for table `users_logs`
--

CREATE TABLE IF NOT EXISTS `users_logs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `log_type` varchar(100) NOT NULL,
  `log_descp` text NOT NULL,
  `user` varchar(50) NOT NULL,
  `dt` varchar(20) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users_logs`
--

INSERT INTO `users_logs` (`id`, `log_type`, `log_descp`, `user`, `dt`) VALUES
(1, 'Edit/Update', 'User ID 2 Suspended!', 'ehtesham', '1696664556'),
(2, 'Edit/Update', 'Department ID 2 Suspended!', 'ehtesham', '1696664800'),
(3, 'Edit/Update', 'Department ID 2 Activated!', 'ehtesham', '1696664808'),
(4, 'Edit/Update', 'User ID 162 Suspended!', 'ehtesham', '1696666797'),
(5, 'New User Created', 'New User Generated on User ID 207', 'ehtesham', '1699611160'),
(6, 'New User Created', 'New User Generated on User ID 208', 'ehtesham', '1699627162'),
(7, 'New User Created', 'New User Generated on User ID 209', 'ehtesham', '1700054493'),
(8, 'New Department Created', 'New Department Generated on Department ID 5', 'ehtesham', '1700054617');

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

--
-- Table structure for table `users_offices`
--

CREATE TABLE IF NOT EXISTS `users_offices` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `address` text NOT NULL,
  `type` varchar(100) NOT NULL,
  `number` varchar(20) NOT NULL,
  `del` varchar(1) NOT NULL DEFAULT 'N',
  `dt` varchar(20) NOT NULL,
  `user` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user` (`user`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users_offices`
--

INSERT INTO `users_offices` (`id`, `name`, `address`, `type`, `number`, `del`, `dt`, `user`) VALUES
(1, 'Elaan Head Office', 'Office No. 1, Second Floor, Gulberg Trade Center, Gulberg Greens, Islamabad', 'Head Office', '051111222679', 'N', '1690277773', 'ehtesham'),
(2, 'Elaan Corporate Office', 'Office No. 1 & 2, First Floor, Sector G-11 Markaz, Islamabad', 'Corporate Office', '051111222679', 'N', '1690277773', 'ehtesham');

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

--
-- Table structure for table `users_salaries`
--

CREATE TABLE IF NOT EXISTS `users_salaries` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `salary` int NOT NULL,
  `health_check` varchar(10) NOT NULL,
  `health_type` varchar(10) NOT NULL DEFAULT 'N/A',
  `health_value` int NOT NULL,
  `travel_check` varchar(10) NOT NULL,
  `travel_type` varchar(10) NOT NULL DEFAULT 'N/A',
  `travel_value` int NOT NULL,
  `food_check` varchar(10) NOT NULL,
  `food_type` varchar(10) NOT NULL DEFAULT 'N/A',
  `food_value` int NOT NULL,
  `overtime_check` varchar(10) NOT NULL,
  `overtime_type` varchar(10) NOT NULL DEFAULT 'N/A',
  `overtime_value` int NOT NULL,
  `overtime_per` varchar(20) NOT NULL,
  `commission_check` varchar(10) NOT NULL,
  `commission_type` varchar(10) NOT NULL DEFAULT 'N/A',
  `commission_value` int NOT NULL,
  `del` varchar(1) NOT NULL DEFAULT 'N',
  `dt` varchar(20) NOT NULL,
  `user` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `health_type` (`health_type`),
  KEY `travel_type` (`travel_type`),
  KEY `food_type` (`food_type`),
  KEY `overtime_type` (`overtime_type`),
  KEY `commission_type` (`commission_type`),
  KEY `user` (`user`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users_salaries`
--

INSERT INTO `users_salaries` (`id`, `user_id`, `salary`, `health_check`, `health_type`, `health_value`, `travel_check`, `travel_type`, `travel_value`, `food_check`, `food_type`, `food_value`, `overtime_check`, `overtime_type`, `overtime_value`, `overtime_per`, `commission_check`, `commission_type`, `commission_value`, `del`, `dt`, `user`) VALUES
(0, 206, 100000, 'on', '%', 16, 'on', 'Rs', 20000, '', 'N/A', 0, 'on', 'Rs', 2018, 'h', 'on', '%', 12, 'N', '1690305858', 'ehtesham'),
(6, 54, 75000, 'on', 'Rs', 2500, 'on', 'Rs', 5000, '', 'N/A', 0, 'on', 'Rs', 8500, 'h', '', 'N/A', 0, 'N', '1690317499', 'ehtesham');

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

--
-- Table structure for table `users_teams`
--

CREATE TABLE IF NOT EXISTS `users_teams` (
  `id` int NOT NULL AUTO_INCREMENT,
  `title` varchar(100) NOT NULL,
  `manager_id` int NOT NULL,
  `zone_id` int NOT NULL,
  `del` varchar(1) NOT NULL DEFAULT 'N',
  `dt` varchar(20) NOT NULL,
  `user` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `manager_id` (`manager_id`),
  KEY `user` (`user`),
  KEY `zone_id` (`zone_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `users_types`
--

CREATE TABLE IF NOT EXISTS `users_types` (
  `id` int NOT NULL AUTO_INCREMENT,
  `type` varchar(50) NOT NULL,
  `permission_level` decimal(10,1) NOT NULL,
  `del` varchar(1) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `category` (`type`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users_types`
--

INSERT INTO `users_types` (`id`, `type`, `permission_level`, `del`) VALUES
(1, 'admin', '9.0', 'N'),
(2, 'standard', '3.0', 'N'),
(3, 'manager', '4.0', 'N'),
(4, 'user', '0.0', 'N'),
(5, 'accounts', '3.0', 'N'),
(6, 'dealer', '3.0', 'N'),
(7, 'director', '6.0', 'N'),
(8, 'zone_manager', '5.0', 'N');

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

--
-- Table structure for table `users_zones`
--

CREATE TABLE IF NOT EXISTS `users_zones` (
  `id` int NOT NULL AUTO_INCREMENT,
  `title` varchar(100) NOT NULL,
  `zonal_manager` int NOT NULL,
  `del` varchar(1) NOT NULL DEFAULT 'N',
  `dt` varchar(20) NOT NULL,
  `user` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `zonal_manager` (`zonal_manager`),
  KEY `user` (`user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `users`
--
ALTER TABLE `users`
  ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`user_type`) REFERENCES `users_types` (`type`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_ibfk_2` FOREIGN KEY (`department`) REFERENCES `users_departments` (`department`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_ibfk_3` FOREIGN KEY (`designation`) REFERENCES `users_designations` (`designation`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_ibfk_4` FOREIGN KEY (`gender`) REFERENCES `users_genders` (`gender`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `users_contracts`
--
ALTER TABLE `users_contracts`
  ADD CONSTRAINT `users_contracts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_contracts_ibfk_2` FOREIGN KEY (`user`) REFERENCES `users` (`name`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_contracts_ibfk_3` FOREIGN KEY (`contract_type`) REFERENCES `users_contracts_types` (`type`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `users_departments`
--
ALTER TABLE `users_departments`
  ADD CONSTRAINT `users_departments_ibfk_1` FOREIGN KEY (`user`) REFERENCES `users` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `users_designations`
--
ALTER TABLE `users_designations`
  ADD CONSTRAINT `users_designations_ibfk_1` FOREIGN KEY (`user`) REFERENCES `users` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `users_details`
--
ALTER TABLE `users_details`
  ADD CONSTRAINT `users_details_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_details_ibfk_2` FOREIGN KEY (`user`) REFERENCES `users` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `users_genders`
--
ALTER TABLE `users_genders`
  ADD CONSTRAINT `users_genders_ibfk_1` FOREIGN KEY (`user`) REFERENCES `users` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `users_jobs`
--
ALTER TABLE `users_jobs`
  ADD CONSTRAINT `users_jobs_ibfk_1` FOREIGN KEY (`day_off`) REFERENCES `soft_days` (`day`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_jobs_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_jobs_ibfk_3` FOREIGN KEY (`user`) REFERENCES `users` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `users_offices`
--
ALTER TABLE `users_offices`
  ADD CONSTRAINT `users_offices_ibfk_1` FOREIGN KEY (`user`) REFERENCES `users` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `users_salaries`
--
ALTER TABLE `users_salaries`
  ADD CONSTRAINT `users_salaries_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_salaries_ibfk_2` FOREIGN KEY (`user`) REFERENCES `users` (`name`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_salaries_ibfk_3` FOREIGN KEY (`commission_type`) REFERENCES `soft_addon_types` (`sign`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_salaries_ibfk_4` FOREIGN KEY (`food_type`) REFERENCES `soft_addon_types` (`sign`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_salaries_ibfk_5` FOREIGN KEY (`health_type`) REFERENCES `soft_addon_types` (`sign`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_salaries_ibfk_6` FOREIGN KEY (`overtime_type`) REFERENCES `soft_addon_types` (`sign`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_salaries_ibfk_7` FOREIGN KEY (`travel_type`) REFERENCES `soft_addon_types` (`sign`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `users_teams`
--
ALTER TABLE `users_teams`
  ADD CONSTRAINT `users_teams_ibfk_1` FOREIGN KEY (`manager_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_teams_ibfk_2` FOREIGN KEY (`user`) REFERENCES `users` (`name`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_teams_ibfk_3` FOREIGN KEY (`zone_id`) REFERENCES `users_zones` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `users_zones`
--
ALTER TABLE `users_zones`
  ADD CONSTRAINT `users_zones_ibfk_1` FOREIGN KEY (`zonal_manager`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `users_zones_ibfk_3` FOREIGN KEY (`user`) REFERENCES `users` (`name`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

