Jan 6, 2021
0
Level 1
Single vendor to multi vendor system
Im little confused which table I have to create to get it work like multi vendor. I've created roles Admin, Owner, Manager, Employee, Customer.
My problem is how I can set User he is owner of business and set manager he can manage this business branch only? and users can see their assigned services.
Actually at the moment employees only see their services and bookings. So thats correct.
My structure is like this:
Salon owner creates account -> creates branch -> adds employees and managers to his branches -> creates services for branch employees.
My database looks like this:
--
-- Table structure for table `bookings`
--
CREATE TABLE `bookings` (
`id` int(10) UNSIGNED NOT NULL,
`deal_id` int(10) UNSIGNED DEFAULT NULL,
`deal_quantity` double DEFAULT NULL,
`coupon_id` bigint(20) UNSIGNED DEFAULT NULL,
`user_id` int(10) UNSIGNED DEFAULT NULL,
`date_time` datetime NOT NULL,
`status` enum('pending','approved','in progress','completed','canceled') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'pending',
`payment_gateway` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`original_amount` double(8,2) NOT NULL,
`discount` double(8,2) NOT NULL,
`coupon_discount` double DEFAULT NULL,
`discount_percent` double NOT NULL,
`tax_name` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`tax_percent` double(8,2) DEFAULT NULL,
`tax_amount` double(8,2) DEFAULT NULL,
`amount_to_pay` double(8,2) NOT NULL,
`payment_status` enum('pending','completed') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'pending',
`source` varchar(191) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'pos',
`additional_notes` text COLLATE utf8_unicode_ci,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `booking_items`
--
CREATE TABLE `booking_items` (
`id` int(10) UNSIGNED NOT NULL,
`booking_id` int(10) UNSIGNED NOT NULL,
`business_service_id` int(10) UNSIGNED NOT NULL,
`quantity` tinyint(4) NOT NULL,
`unit_price` double NOT NULL,
`amount` double NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `booking_times`
--
CREATE TABLE `booking_times` (
`id` int(10) UNSIGNED NOT NULL,
`day` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`start_time` time NOT NULL,
`end_time` time NOT NULL,
`multiple_booking` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes',
`max_booking` int(11) NOT NULL DEFAULT '0',
`status` enum('enabled','disabled') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'enabled',
`slot_duration` int(11) NOT NULL DEFAULT '30',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `booking_user`
--
CREATE TABLE `booking_user` (
`booking_id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `business_services`
--
CREATE TABLE `business_services` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`slug` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`description` text COLLATE utf8_unicode_ci NOT NULL,
`price` double(8,2) NOT NULL,
`time` double(8,2) NOT NULL,
`time_type` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`discount` double(8,2) NOT NULL,
`discount_type` enum('percent','fixed') COLLATE utf8_unicode_ci NOT NULL,
`category_id` int(10) UNSIGNED DEFAULT NULL,
`location_id` int(10) UNSIGNED NOT NULL DEFAULT '1',
`image` text COLLATE utf8_unicode_ci,
`default_image` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`status` enum('active','deactive') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'active',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `business_service_user`
--
CREATE TABLE `business_service_user` (
`business_service_id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
CREATE TABLE `categories` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`slug` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`image` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`status` enum('active','deactive') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'active',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `company_settings`
--
CREATE TABLE `company_settings` (
`id` int(10) UNSIGNED NOT NULL,
`company_name` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`company_email` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`company_phone` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`logo` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`address` text COLLATE utf8_unicode_ci NOT NULL,
`date_format` varchar(191) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Y-m-d',
`time_format` varchar(191) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'h:i A',
`website` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`timezone` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`locale` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`latitude` decimal(10,8) NOT NULL,
`longitude` decimal(11,8) NOT NULL,
`currency_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`purchase_code` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`supported_until` timestamp NULL DEFAULT NULL,
`multi_task_user` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`booking_per_day` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`employee_selection` enum('enabled','disabled') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'disabled',
`disable_slot` enum('enabled','disabled') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'disabled',
`booking_time_type` enum('sum','avg','max','min') COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `coupons`
--
CREATE TABLE `coupons` (
`id` bigint(20) UNSIGNED NOT NULL,
`title` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`start_date_time` datetime DEFAULT NULL,
`end_date_time` datetime DEFAULT NULL,
`uses_limit` int(11) DEFAULT NULL,
`used_time` int(11) DEFAULT NULL,
`amount` double DEFAULT NULL,
`percent` int(11) DEFAULT NULL,
`minimum_purchase_amount` int(11) NOT NULL DEFAULT '0',
`days` text COLLATE utf8_unicode_ci,
`status` enum('active','inactive','expire') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'active',
`description` text COLLATE utf8_unicode_ci,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `coupon_users`
--
CREATE TABLE `coupon_users` (
`id` bigint(20) UNSIGNED NOT NULL,
`coupon_id` bigint(20) UNSIGNED DEFAULT NULL,
`user_id` int(10) UNSIGNED DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `currencies`
--
CREATE TABLE `currencies` (
`id` int(10) UNSIGNED NOT NULL,
`currency_name` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`currency_symbol` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`currency_code` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `deals`
--
CREATE TABLE `deals` (
`id` int(10) UNSIGNED NOT NULL,
`title` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`slug` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`location_id` int(11) NOT NULL,
`deal_type` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`start_date_time` datetime DEFAULT NULL,
`end_date_time` datetime DEFAULT NULL,
`open_time` time NOT NULL,
`close_time` time NOT NULL,
`uses_limit` int(11) DEFAULT NULL,
`used_time` int(11) DEFAULT NULL,
`original_amount` double DEFAULT NULL,
`deal_amount` double DEFAULT NULL,
`days` text COLLATE utf8_unicode_ci,
`image` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`status` enum('active','inactive','expire') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'active',
`description` text COLLATE utf8_unicode_ci,
`discount_type` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`percentage` int(11) DEFAULT NULL,
`deal_applied_on` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`max_order_per_customer` int(11) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `deal_items`
--
CREATE TABLE `deal_items` (
`id` int(10) UNSIGNED NOT NULL,
`deal_id` int(10) UNSIGNED DEFAULT NULL,
`business_service_id` int(10) UNSIGNED DEFAULT NULL,
`quantity` tinyint(4) NOT NULL,
`unit_price` double NOT NULL,
`discount_amount` double NOT NULL,
`total_amount` double NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `employee_groups`
--
CREATE TABLE `employee_groups` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`status` enum('active','deactive') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'active',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `employee_group_services`
--
CREATE TABLE `employee_group_services` (
`id` bigint(20) UNSIGNED NOT NULL,
`employee_groups_id` int(10) UNSIGNED DEFAULT NULL,
`business_service_id` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `employee_schedules`
--
CREATE TABLE `employee_schedules` (
`id` int(10) UNSIGNED NOT NULL,
`employee_id` int(10) UNSIGNED NOT NULL,
`is_working` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`start_time` time DEFAULT NULL,
`end_time` time DEFAULT NULL,
`days` text COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `front_theme_settings`
--
CREATE TABLE `front_theme_settings` (
`id` int(10) UNSIGNED NOT NULL,
`primary_color` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`secondary_color` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`custom_css` longtext COLLATE utf8_unicode_ci,
`logo` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`carousel_status` enum('enabled','disabled') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'enabled',
`seo_description` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`seo_keywords` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `languages`
--
CREATE TABLE `languages` (
`id` int(10) UNSIGNED NOT NULL,
`language_code` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`language_name` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`status` enum('enabled','disabled') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'disabled',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `leaves`
--
CREATE TABLE `leaves` (
`id` int(10) UNSIGNED NOT NULL,
`employee_id` int(10) UNSIGNED NOT NULL,
`start_date` date NOT NULL,
`end_date` date DEFAULT NULL,
`start_time` time DEFAULT NULL,
`end_time` time DEFAULT NULL,
`leave_type` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `locations`
--
CREATE TABLE `locations` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `ltm_translations`
--
CREATE TABLE `ltm_translations` (
`id` int(10) UNSIGNED NOT NULL,
`status` int(11) NOT NULL DEFAULT '0',
`locale` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`group` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`key` text COLLATE utf8_unicode_ci NOT NULL,
`value` text COLLATE utf8_unicode_ci,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `media`
--
CREATE TABLE `media` (
`id` int(10) UNSIGNED NOT NULL,
`file_name` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `modules`
--
CREATE TABLE `modules` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`display_name` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`description` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `pages`
--
CREATE TABLE `pages` (
`id` bigint(20) UNSIGNED NOT NULL,
`title` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`content` text COLLATE utf8_unicode_ci NOT NULL,
`slug` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`token` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `payments`
--
CREATE TABLE `payments` (
`id` int(10) UNSIGNED NOT NULL,
`currency_id` int(11) DEFAULT NULL,
`booking_id` int(10) UNSIGNED NOT NULL,
`amount` double NOT NULL,
`gateway` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`transaction_id` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`status` enum('completed','pending') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'pending',
`paid_on` datetime DEFAULT NULL,
`customer_id` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`event_id` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `payment_gateway_credentials`
--
CREATE TABLE `payment_gateway_credentials` (
`id` int(10) UNSIGNED NOT NULL,
`paypal_client_id` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`paypal_secret` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`stripe_client_id` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`stripe_secret` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`stripe_webhook_secret` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`stripe_status` enum('active','deactive') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'deactive',
`paypal_status` enum('active','deactive') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'deactive',
`paypal_mode` enum('sandbox','live') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'sandbox',
`offline_payment` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
`show_payment_options` enum('hide','show') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'show',
`razorpay_key` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`razorpay_secret` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`razorpay_status` enum('active','deactive') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'deactive',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `permissions`
--
CREATE TABLE `permissions` (
`id` int(10) UNSIGNED NOT NULL,
`module_id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`display_name` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`description` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `permission_role`
--
CREATE TABLE `permission_role` (
`permission_id` int(10) UNSIGNED NOT NULL,
`role_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `permission_user`
--
CREATE TABLE `permission_user` (
`permission_id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`user_type` varchar(191) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `roles`
--
CREATE TABLE `roles` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`display_name` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`description` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `role_user`
--
CREATE TABLE `role_user` (
`role_id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`user_type` varchar(191) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `sms_settings`
--
CREATE TABLE `sms_settings` (
`id` bigint(20) UNSIGNED NOT NULL,
`nexmo_status` enum('active','deactive') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'deactive',
`nexmo_key` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`nexmo_secret` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`nexmo_from` varchar(191) COLLATE utf8_unicode_ci DEFAULT 'NEXMO',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `smtp_settings`
--
CREATE TABLE `smtp_settings` (
`id` int(10) UNSIGNED NOT NULL,
`mail_driver` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`mail_host` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`mail_port` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`mail_username` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`mail_password` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`mail_from_name` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`mail_from_email` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`mail_encryption` enum('none','tls','ssl') COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`verified` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `tax_settings`
--
CREATE TABLE `tax_settings` (
`id` int(10) UNSIGNED NOT NULL,
`tax_name` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`percent` double(8,2) NOT NULL,
`status` enum('active','deactive') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'active',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `theme_settings`
--
CREATE TABLE `theme_settings` (
`id` int(10) UNSIGNED NOT NULL,
`primary_color` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`secondary_color` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`sidebar_bg_color` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`sidebar_text_color` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`topbar_text_color` varchar(191) COLLATE utf8_unicode_ci NOT NULL DEFAULT '#FFFFFF',
`custom_css` longtext COLLATE utf8_unicode_ci,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `todo_items`
--
CREATE TABLE `todo_items` (
`id` bigint(20) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`title` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`status` enum('pending','completed') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'pending',
`position` int(10) UNSIGNED NOT NULL DEFAULT '0',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `universal_searches`
--
CREATE TABLE `universal_searches` (
`id` bigint(20) UNSIGNED NOT NULL,
`searchable_id` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`searchable_type` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`title` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`route_name` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`group_id` int(11) DEFAULT NULL,
`name` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`calling_code` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`mobile` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`mobile_verified` tinyint(1) NOT NULL DEFAULT '0',
`password` varchar(191) COLLATE utf8_unicode_ci NOT NULL,
`image` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
`remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `bookings`
--
ALTER TABLE `bookings`
ADD PRIMARY KEY (`id`),
ADD KEY `bookings_user_id_foreign` (`user_id`),
ADD KEY `bookings_coupon_id_foreign` (`coupon_id`),
ADD KEY `bookings_deal_id_foreign` (`deal_id`);
--
-- Indexes for table `booking_items`
--
ALTER TABLE `booking_items`
ADD PRIMARY KEY (`id`),
ADD KEY `booking_items_booking_id_foreign` (`booking_id`),
ADD KEY `booking_items_business_service_id_foreign` (`business_service_id`);
--
-- Indexes for table `booking_times`
--
ALTER TABLE `booking_times`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `booking_user`
--
ALTER TABLE `booking_user`
ADD PRIMARY KEY (`booking_id`,`user_id`),
ADD KEY `booking_user_user_id_foreign` (`user_id`);
--
-- Indexes for table `business_services`
--
ALTER TABLE `business_services`
ADD PRIMARY KEY (`id`),
ADD KEY `business_services_category_id_foreign` (`category_id`),
ADD KEY `business_services_location_id_foreign` (`location_id`);
--
-- Indexes for table `business_service_user`
--
ALTER TABLE `business_service_user`
ADD PRIMARY KEY (`business_service_id`,`user_id`),
ADD KEY `business_service_user_user_id_foreign` (`user_id`);
--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `company_settings`
--
ALTER TABLE `company_settings`
ADD PRIMARY KEY (`id`),
ADD KEY `company_settings_currency_id_foreign` (`currency_id`);
--
-- Indexes for table `coupons`
--
ALTER TABLE `coupons`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `coupon_users`
--
ALTER TABLE `coupon_users`
ADD PRIMARY KEY (`id`),
ADD KEY `coupon_users_coupon_id_foreign` (`coupon_id`),
ADD KEY `coupon_users_user_id_foreign` (`user_id`);
--
-- Indexes for table `currencies`
--
ALTER TABLE `currencies`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `deals`
--
ALTER TABLE `deals`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `deal_items`
--
ALTER TABLE `deal_items`
ADD PRIMARY KEY (`id`),
ADD KEY `deal_items_deal_id_foreign` (`deal_id`),
ADD KEY `deal_items_business_service_id_foreign` (`business_service_id`);
--
-- Indexes for table `employee_groups`
--
ALTER TABLE `employee_groups`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `employee_group_services`
--
ALTER TABLE `employee_group_services`
ADD PRIMARY KEY (`id`),
ADD KEY `employee_group_services_employee_groups_id_foreign` (`employee_groups_id`),
ADD KEY `employee_group_services_business_service_id_foreign` (`business_service_id`);
--
-- Indexes for table `employee_schedules`
--
ALTER TABLE `employee_schedules`
ADD PRIMARY KEY (`id`),
ADD KEY `employee_schedules_employee_id_foreign` (`employee_id`);
--
-- Indexes for table `front_theme_settings`
--
ALTER TABLE `front_theme_settings`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `languages`
--
ALTER TABLE `languages`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `leaves`
--
ALTER TABLE `leaves`
ADD PRIMARY KEY (`id`),
ADD KEY `leaves_employee_id_foreign` (`employee_id`);
--
-- Indexes for table `locations`
--
ALTER TABLE `locations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `ltm_translations`
--
ALTER TABLE `ltm_translations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `media`
--
ALTER TABLE `media`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `modules`
--
ALTER TABLE `modules`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `pages`
--
ALTER TABLE `pages`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `payments_transaction_id_unique` (`transaction_id`),
ADD UNIQUE KEY `payments_event_id_unique` (`event_id`),
ADD KEY `payments_booking_id_foreign` (`booking_id`);
--
-- Indexes for table `payment_gateway_credentials`
--
ALTER TABLE `payment_gateway_credentials`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `permissions`
--
ALTER TABLE `permissions`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `permissions_name_unique` (`name`);
--
-- Indexes for table `permission_role`
--
ALTER TABLE `permission_role`
ADD PRIMARY KEY (`permission_id`,`role_id`),
ADD KEY `permission_role_role_id_foreign` (`role_id`);
--
-- Indexes for table `permission_user`
--
ALTER TABLE `permission_user`
ADD PRIMARY KEY (`user_id`,`permission_id`,`user_type`),
ADD KEY `permission_user_permission_id_foreign` (`permission_id`);
--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `roles_name_unique` (`name`);
--
-- Indexes for table `role_user`
--
ALTER TABLE `role_user`
ADD PRIMARY KEY (`user_id`,`role_id`,`user_type`),
ADD KEY `role_user_role_id_foreign` (`role_id`);
--
-- Indexes for table `sms_settings`
--
ALTER TABLE `sms_settings`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `smtp_settings`
--
ALTER TABLE `smtp_settings`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tax_settings`
--
ALTER TABLE `tax_settings`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `theme_settings`
--
ALTER TABLE `theme_settings`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `todo_items`
--
ALTER TABLE `todo_items`
ADD PRIMARY KEY (`id`),
ADD KEY `todo_items_user_id_foreign` (`user_id`);
--
-- Indexes for table `universal_searches`
--
ALTER TABLE `universal_searches`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `bookings`
--
ALTER TABLE `bookings`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `booking_items`
--
ALTER TABLE `booking_items`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `booking_times`
--
ALTER TABLE `booking_times`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `business_services`
--
ALTER TABLE `business_services`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `company_settings`
--
ALTER TABLE `company_settings`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `coupons`
--
ALTER TABLE `coupons`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `coupon_users`
--
ALTER TABLE `coupon_users`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `currencies`
--
ALTER TABLE `currencies`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `deals`
--
ALTER TABLE `deals`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `deal_items`
--
ALTER TABLE `deal_items`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `employee_groups`
--
ALTER TABLE `employee_groups`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `employee_group_services`
--
ALTER TABLE `employee_group_services`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `employee_schedules`
--
ALTER TABLE `employee_schedules`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `front_theme_settings`
--
ALTER TABLE `front_theme_settings`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `languages`
--
ALTER TABLE `languages`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `leaves`
--
ALTER TABLE `leaves`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `locations`
--
ALTER TABLE `locations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `ltm_translations`
--
ALTER TABLE `ltm_translations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `media`
--
ALTER TABLE `media`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `modules`
--
ALTER TABLE `modules`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `pages`
--
ALTER TABLE `pages`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `payments`
--
ALTER TABLE `payments`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `payment_gateway_credentials`
--
ALTER TABLE `payment_gateway_credentials`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `permissions`
--
ALTER TABLE `permissions`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sms_settings`
--
ALTER TABLE `sms_settings`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `smtp_settings`
--
ALTER TABLE `smtp_settings`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tax_settings`
--
ALTER TABLE `tax_settings`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `theme_settings`
--
ALTER TABLE `theme_settings`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `todo_items`
--
ALTER TABLE `todo_items`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `universal_searches`
--
ALTER TABLE `universal_searches`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `bookings`
--
ALTER TABLE `bookings`
ADD CONSTRAINT `bookings_coupon_id_foreign` FOREIGN KEY (`coupon_id`) REFERENCES `coupons` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `bookings_deal_id_foreign` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `bookings_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `booking_items`
--
ALTER TABLE `booking_items`
ADD CONSTRAINT `booking_items_booking_id_foreign` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `booking_items_business_service_id_foreign` FOREIGN KEY (`business_service_id`) REFERENCES `business_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `booking_user`
--
ALTER TABLE `booking_user`
ADD CONSTRAINT `booking_user_booking_id_foreign` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `booking_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `business_services`
--
ALTER TABLE `business_services`
ADD CONSTRAINT `business_services_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `business_services_location_id_foreign` FOREIGN KEY (`location_id`) REFERENCES `locations` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `business_service_user`
--
ALTER TABLE `business_service_user`
ADD CONSTRAINT `business_service_user_business_service_id_foreign` FOREIGN KEY (`business_service_id`) REFERENCES `business_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `business_service_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `company_settings`
--
ALTER TABLE `company_settings`
ADD CONSTRAINT `company_settings_currency_id_foreign` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON UPDATE CASCADE;
--
-- Constraints for table `coupon_users`
--
ALTER TABLE `coupon_users`
ADD CONSTRAINT `coupon_users_coupon_id_foreign` FOREIGN KEY (`coupon_id`) REFERENCES `coupons` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `coupon_users_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `deal_items`
--
ALTER TABLE `deal_items`
ADD CONSTRAINT `deal_items_business_service_id_foreign` FOREIGN KEY (`business_service_id`) REFERENCES `business_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `deal_items_deal_id_foreign` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `employee_group_services`
--
ALTER TABLE `employee_group_services`
ADD CONSTRAINT `employee_group_services_business_service_id_foreign` FOREIGN KEY (`business_service_id`) REFERENCES `business_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `employee_group_services_employee_groups_id_foreign` FOREIGN KEY (`employee_groups_id`) REFERENCES `employee_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `employee_schedules`
--
ALTER TABLE `employee_schedules`
ADD CONSTRAINT `employee_schedules_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `leaves`
--
ALTER TABLE `leaves`
ADD CONSTRAINT `leaves_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `payments`
--
ALTER TABLE `payments`
ADD CONSTRAINT `payments_booking_id_foreign` FOREIGN KEY (`booking_id`) REFERENCES `bookings` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `permission_role`
--
ALTER TABLE `permission_role`
ADD CONSTRAINT `permission_role_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `permission_role_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `permission_user`
--
ALTER TABLE `permission_user`
ADD CONSTRAINT `permission_user_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `role_user`
--
ALTER TABLE `role_user`
ADD CONSTRAINT `role_user_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `todo_items`
--
ALTER TABLE `todo_items`
ADD CONSTRAINT `todo_items_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
Please or to participate in this conversation.