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

START TRANSACTION;



--
-- Database: `rldersau_nlms`
--

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

--
-- Table structure for table `channel_users`
--

CREATE TABLE `channel_users` (
  `id` int(11) NOT NULL,
  `channel_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `chat_channels`
--

CREATE TABLE `chat_channels` (
  `id` int(11) NOT NULL,
  `channel_name` varchar(100) NOT NULL,
  `is_private` tinyint(1) DEFAULT 0,
  `created_by` int(11) NOT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `chat_channels`
--

INSERT INTO `chat_channels` (`id`, `channel_name`, `is_private`, `created_by`, `created_at`) VALUES
(1, 'General', 0, 1, '2025-04-12 20:18:52');

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

--
-- Table structure for table `chat_invite_notifications`
--

CREATE TABLE `chat_invite_notifications` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `channel_id` int(11) NOT NULL,
  `is_read` tinyint(1) DEFAULT 0,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `chat_mentions`
--

CREATE TABLE `chat_mentions` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `channel_id` int(11) NOT NULL,
  `message` text DEFAULT NULL,
  `mentioned_by` int(11) NOT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `is_read` tinyint(4) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `chat_messages`
--

CREATE TABLE `chat_messages` (
  `id` int(11) NOT NULL,
  `channel_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `message` text NOT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `leads`
--

CREATE TABLE `leads` (
  `id` int(11) NOT NULL,
  `lead_owner` int(11) NOT NULL,
  `lead_title` varchar(255) NOT NULL,
  `stage` int(11) DEFAULT NULL,
  `client_name` varchar(255) NOT NULL,
  `source` int(11) DEFAULT NULL,
  `category` int(11) DEFAULT NULL,
  `description` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT NULL,
  `updated_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `lead_assignments`
--

CREATE TABLE `lead_assignments` (
  `id` int(11) NOT NULL,
  `lead_id` int(11) NOT NULL,
  `assigned_by` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `assigned_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `lead_categories`
--

CREATE TABLE `lead_categories` (
  `id` int(11) NOT NULL,
  `category_name` varchar(255) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `lead_comments`
--

CREATE TABLE `lead_comments` (
  `id` int(11) NOT NULL,
  `lead_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `comment_text` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `lead_sources`
--

CREATE TABLE `lead_sources` (
  `id` int(11) NOT NULL,
  `source_name` varchar(255) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `lead_stages`
--

CREATE TABLE `lead_stages` (
  `id` int(11) NOT NULL,
  `stage_name` varchar(255) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

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

CREATE TABLE `notifications` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `message` text NOT NULL,
  `lead_id` int(11) NOT NULL,
  `assigned_by` varchar(255) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `is_read` tinyint(1) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `page_permissions`
--

CREATE TABLE `page_permissions` (
  `id` int(11) NOT NULL,
  `page` varchar(255) NOT NULL,
  `permission` varchar(255) NOT NULL,
  `label` varchar(100) NOT NULL DEFAULT '',
  `section` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'General',
  `icon` varchar(100) DEFAULT NULL,
  `sort_order` int(11) DEFAULT 0,
  `section_sort_order` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;



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

--
-- Table structure for table `password_resets`
--

CREATE TABLE `password_resets` (
  `id` int(11) NOT NULL,
  `email` varchar(255) NOT NULL,
  `token` varchar(64) NOT NULL,
  `expires_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `permissions`
--

CREATE TABLE `permissions` (
  `id` int(11) NOT NULL,
  `permission_name` varchar(255) NOT NULL,
  `module` varchar(100) DEFAULT 'General'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `permissions`
--

INSERT INTO `permissions` (`id`, `permission_name`, `module`) VALUES
(1, 'add_users', 'Users'),
(2, 'edit_user', 'Users'),
(3, 'delete_user', 'Users'),
(4, 'list_users', 'Users'),
(5, 'manage_specializations', 'Users'),
(6, 'edit_specialization', 'Users'),
(7, 'delete_specialization', 'Users'),
(8, 'manage_roles', 'Roles'),
(9, 'edit_role', 'Roles'),
(10, 'delete_role', 'Roles'),
(11, 'assign_permissions', 'Roles'),
(12, 'add_lead', 'Leads'),
(13, 'edit_lead', 'Leads'),
(14, 'delete_lead', 'Leads'),
(15, 'list_leads', 'Leads'),
(16, 'assigned_leads', 'Leads'),
(17, 'manage_lead_stages', 'Leads'),
(18, 'edit_stage', 'Leads'),
(19, 'delete_stage', 'Leads'),
(20, 'manage_lead_sources', 'Leads'),
(21, 'edit_source', 'Leads'),
(22, 'delete_source', 'Leads'),
(23, 'manage_lead_categories', 'Leads'),
(24, 'edit_category', 'Leads'),
(25, 'delete_category', 'Leads'),
(26, 'view_comments', 'Comments'),
(27, 'delete_comment', 'Comments'),
(28, 'upload_docs', 'Documents'),
(29, 'delete_document', 'Documents'),
(30, 'settings', 'Settings'),
(31, 'edit_settings', 'Settings'),
(32, 'dashboard', 'General'),
(33, 'chatroom', 'Messages'),
(34, 'leads_report', 'Leads'),
(36, 'view_change_password', 'Users'),
(37, 'view_detailed_leads_report', 'Leads'),
(38, 'view_login', 'Users'),
(39, 'view_notifications_list', 'general'),
(40, 'view_profile', 'Users'),
(41, 'view_forgot_password', 'general'),
(42, 'view_reset_password', 'general'),
(43, 'view_index', 'general'),
(44, 'view_check_install_folder', 'general'),
(45, 'view_success', 'general');

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

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` int(11) NOT NULL,
  `role_name` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` (`id`, `role_name`) VALUES
(2, 'Developer'),
(1, 'Superadmin');

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

--
-- Table structure for table `role_permissions`
--

CREATE TABLE `role_permissions` (
  `id` int(11) NOT NULL,
  `role_id` int(11) NOT NULL,
  `permission` varchar(255) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `role_permissions`
--

INSERT INTO `role_permissions` (`id`, `role_id`, `permission`, `created_at`) VALUES
(97, 1, 'delete_comment', '2025-04-09 21:53:21'),
(98, 1, 'view_comments', '2025-04-09 21:53:21'),
(99, 1, 'delete_document', '2025-04-09 21:53:21'),
(100, 1, 'upload_docs', '2025-04-09 21:53:21'),
(101, 1, 'dashboard', '2025-04-09 21:53:21'),
(102, 1, 'view_notifications_list', '2025-04-09 21:53:21'),
(103, 1, 'add_lead', '2025-04-09 21:53:21'),
(104, 1, 'assigned_leads', '2025-04-09 21:53:21'),
(105, 1, 'delete_category', '2025-04-09 21:53:21'),
(106, 1, 'delete_lead', '2025-04-09 21:53:21'),
(107, 1, 'delete_source', '2025-04-09 21:53:21'),
(108, 1, 'delete_stage', '2025-04-09 21:53:21'),
(109, 1, 'edit_category', '2025-04-09 21:53:21'),
(110, 1, 'edit_lead', '2025-04-09 21:53:21'),
(111, 1, 'edit_source', '2025-04-09 21:53:21'),
(112, 1, 'edit_stage', '2025-04-09 21:53:21'),
(113, 1, 'leads_report', '2025-04-09 21:53:21'),
(114, 1, 'list_leads', '2025-04-09 21:53:21'),
(115, 1, 'manage_lead_categories', '2025-04-09 21:53:21'),
(116, 1, 'manage_lead_sources', '2025-04-09 21:53:21'),
(117, 1, 'manage_lead_stages', '2025-04-09 21:53:21'),
(118, 1, 'view_detailed_leads_report', '2025-04-09 21:53:21'),
(119, 1, 'chatroom', '2025-04-09 21:53:21'),
(120, 1, 'assign_permissions', '2025-04-09 21:53:21'),
(121, 1, 'delete_role', '2025-04-09 21:53:21'),
(122, 1, 'edit_role', '2025-04-09 21:53:21'),
(123, 1, 'manage_roles', '2025-04-09 21:53:21'),
(124, 1, 'edit_settings', '2025-04-09 21:53:21'),
(125, 1, 'settings', '2025-04-09 21:53:21'),
(126, 1, 'add_users', '2025-04-09 21:53:21'),
(127, 1, 'delete_specialization', '2025-04-09 21:53:21'),
(128, 1, 'delete_user', '2025-04-09 21:53:21'),
(129, 1, 'edit_specialization', '2025-04-09 21:53:21'),
(130, 1, 'edit_user', '2025-04-09 21:53:21'),
(131, 1, 'list_users', '2025-04-09 21:53:21'),
(132, 1, 'manage_specializations', '2025-04-09 21:53:21'),
(133, 1, 'view_change_password', '2025-04-09 21:53:21'),
(134, 1, 'view_login', '2025-04-09 21:53:21'),
(135, 1, 'view_profile', '2025-04-09 21:53:21'),
(159, 1, 'view_forgot_password', '2025-04-10 18:50:02'),
(160, 1, 'view_reset_password', '2025-04-10 18:50:02'),
(161, 1, 'view_index', '2025-04-10 19:08:25'),
(162, 1, 'view_check_install_folder', '2025-04-11 23:34:04'),
(163, 1, 'view_success', '2025-04-11 23:34:04'),
(164, 2, 'delete_comment', '2025-04-12 02:31:51'),
(165, 2, 'view_comments', '2025-04-12 02:31:51'),
(166, 2, 'delete_document', '2025-04-12 02:31:51'),
(167, 2, 'upload_docs', '2025-04-12 02:31:51'),
(168, 2, 'dashboard', '2025-04-12 02:31:51'),
(169, 2, 'view_check_install_folder', '2025-04-12 02:31:51'),
(170, 2, 'view_forgot_password', '2025-04-12 02:31:51'),
(171, 2, 'view_index', '2025-04-12 02:31:51'),
(172, 2, 'view_notifications_list', '2025-04-12 02:31:51'),
(173, 2, 'view_reset_password', '2025-04-12 02:31:51'),
(174, 2, 'view_success', '2025-04-12 02:31:51'),
(175, 2, 'add_lead', '2025-04-12 02:31:51'),
(176, 2, 'assigned_leads', '2025-04-12 02:31:51'),
(177, 2, 'delete_category', '2025-04-12 02:31:51'),
(178, 2, 'delete_lead', '2025-04-12 02:31:51'),
(179, 2, 'delete_source', '2025-04-12 02:31:51'),
(180, 2, 'delete_stage', '2025-04-12 02:31:51'),
(181, 2, 'edit_category', '2025-04-12 02:31:51'),
(182, 2, 'edit_lead', '2025-04-12 02:31:51'),
(183, 2, 'edit_source', '2025-04-12 02:31:51'),
(184, 2, 'edit_stage', '2025-04-12 02:31:51'),
(185, 2, 'leads_report', '2025-04-12 02:31:51'),
(186, 2, 'list_leads', '2025-04-12 02:31:51'),
(187, 2, 'manage_lead_categories', '2025-04-12 02:31:51'),
(188, 2, 'manage_lead_sources', '2025-04-12 02:31:51'),
(189, 2, 'manage_lead_stages', '2025-04-12 02:31:51'),
(190, 2, 'view_detailed_leads_report', '2025-04-12 02:31:51'),
(191, 2, 'chatroom', '2025-04-12 02:31:51'),
(192, 2, 'assign_permissions', '2025-04-12 02:31:51'),
(193, 2, 'delete_role', '2025-04-12 02:31:51'),
(194, 2, 'edit_role', '2025-04-12 02:31:51'),
(195, 2, 'manage_roles', '2025-04-12 02:31:51'),
(196, 2, 'edit_settings', '2025-04-12 02:31:51'),
(197, 2, 'settings', '2025-04-12 02:31:51'),
(198, 2, 'add_users', '2025-04-12 02:31:51'),
(199, 2, 'delete_specialization', '2025-04-12 02:31:51'),
(200, 2, 'delete_user', '2025-04-12 02:31:51'),
(201, 2, 'edit_specialization', '2025-04-12 02:31:51'),
(202, 2, 'edit_user', '2025-04-12 02:31:51'),
(203, 2, 'list_users', '2025-04-12 02:31:51'),
(204, 2, 'manage_specializations', '2025-04-12 02:31:51'),
(205, 2, 'view_change_password', '2025-04-12 02:31:51'),
(206, 2, 'view_login', '2025-04-12 02:31:51'),
(207, 2, 'view_profile', '2025-04-12 02:31:51');

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

--
-- Table structure for table `site_settings`
--

CREATE TABLE `site_settings` (
  `id` int(11) NOT NULL,
  `group` varchar(50) NOT NULL,
  `key` varchar(100) NOT NULL,
  `value` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;



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

--
-- Table structure for table `specializations`
--

CREATE TABLE `specializations` (
  `id` int(11) NOT NULL,
  `specialization_name` varchar(255) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `channel_users`
--
ALTER TABLE `channel_users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `channel_id` (`channel_id`,`user_id`),
  ADD KEY `user_id` (`user_id`);

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

--
-- Indexes for table `chat_invite_notifications`
--
ALTER TABLE `chat_invite_notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `channel_id` (`channel_id`);

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

--
-- Indexes for table `chat_messages`
--
ALTER TABLE `chat_messages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `channel_id` (`channel_id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `leads`
--
ALTER TABLE `leads`
  ADD PRIMARY KEY (`id`),
  ADD KEY `lead_owner` (`lead_owner`);

--
-- Indexes for table `lead_assignments`
--
ALTER TABLE `lead_assignments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `lead_id` (`lead_id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `lead_categories`
--
ALTER TABLE `lead_categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `category_name` (`category_name`);

--
-- Indexes for table `lead_comments`
--
ALTER TABLE `lead_comments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `lead_id` (`lead_id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `lead_sources`
--
ALTER TABLE `lead_sources`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `source_name` (`source_name`);

--
-- Indexes for table `lead_stages`
--
ALTER TABLE `lead_stages`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `stage_name` (`stage_name`);

--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `lead_id` (`lead_id`);

--
-- Indexes for table `page_permissions`
--
ALTER TABLE `page_permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `page` (`page`);

--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `email` (`email`);

--
-- Indexes for table `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `permission_name` (`permission_name`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `role_name` (`role_name`);

--
-- Indexes for table `role_permissions`
--
ALTER TABLE `role_permissions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `role_id` (`role_id`);

--
-- Indexes for table `site_settings`
--
ALTER TABLE `site_settings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_setting` (`group`,`key`);

--
-- Indexes for table `specializations`
--
ALTER TABLE `specializations`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `specialization_name` (`specialization_name`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `channel_users`
--
ALTER TABLE `channel_users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `chat_channels`
--
ALTER TABLE `chat_channels`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `chat_invite_notifications`
--
ALTER TABLE `chat_invite_notifications`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `chat_mentions`
--
ALTER TABLE `chat_mentions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `chat_messages`
--
ALTER TABLE `chat_messages`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `leads`
--
ALTER TABLE `leads`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `lead_assignments`
--
ALTER TABLE `lead_assignments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `lead_categories`
--
ALTER TABLE `lead_categories`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `lead_comments`
--
ALTER TABLE `lead_comments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `lead_sources`
--
ALTER TABLE `lead_sources`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `lead_stages`
--
ALTER TABLE `lead_stages`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `page_permissions`
--
ALTER TABLE `page_permissions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;

--
-- AUTO_INCREMENT for table `password_resets`
--
ALTER TABLE `password_resets`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=46;

--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `role_permissions`
--
ALTER TABLE `role_permissions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=208;

--
-- AUTO_INCREMENT for table `site_settings`
--
ALTER TABLE `site_settings`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;

--
-- AUTO_INCREMENT for table `specializations`
--
ALTER TABLE `specializations`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `channel_users`
--
ALTER TABLE `channel_users`
  ADD CONSTRAINT `channel_users_ibfk_1` FOREIGN KEY (`channel_id`) REFERENCES `chat_channels` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `channel_users_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `chat_invite_notifications`
--
ALTER TABLE `chat_invite_notifications`
  ADD CONSTRAINT `chat_invite_notifications_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `chat_invite_notifications_ibfk_2` FOREIGN KEY (`channel_id`) REFERENCES `chat_channels` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `chat_messages`
--
ALTER TABLE `chat_messages`
  ADD CONSTRAINT `chat_messages_ibfk_1` FOREIGN KEY (`channel_id`) REFERENCES `chat_channels` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `chat_messages_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `leads`
--
ALTER TABLE `leads`
  ADD CONSTRAINT `leads_ibfk_1` FOREIGN KEY (`lead_owner`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `lead_assignments`
--
ALTER TABLE `lead_assignments`
  ADD CONSTRAINT `lead_assignments_ibfk_1` FOREIGN KEY (`lead_id`) REFERENCES `leads` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `lead_assignments_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `lead_comments`
--
ALTER TABLE `lead_comments`
  ADD CONSTRAINT `lead_comments_ibfk_1` FOREIGN KEY (`lead_id`) REFERENCES `leads` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `lead_comments_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `notifications`
--
ALTER TABLE `notifications`
  ADD CONSTRAINT `notifications_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `notifications_ibfk_2` FOREIGN KEY (`lead_id`) REFERENCES `leads` (`id`) ON DELETE CASCADE;
COMMIT;

