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

START TRANSACTION;



--
-- Database: `cf_v3`
--

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

--
-- Table structure for table `attendances`
--

CREATE TABLE `attendances` (
  `id` bigint UNSIGNED NOT NULL,
  `member_id` bigint NOT NULL,
  `attendance_date` date NOT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `expenses`
--

CREATE TABLE `expenses` (
  `id` bigint UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint UNSIGNED NOT NULL,
  `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `incomes`
--

CREATE TABLE `incomes` (
  `id` bigint UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `members`
--

CREATE TABLE `members` (
  `id` bigint UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `reg_no` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `profile_picture` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `interested_area` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `age` int DEFAULT NULL,
  `gender` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `height` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `weight` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `memberships`
--

CREATE TABLE `memberships` (
  `id` bigint UNSIGNED NOT NULL,
  `member_id` bigint NOT NULL,
  `membership_type_id` bigint NOT NULL,
  `valid_from` datetime NOT NULL,
  `valid_to` datetime NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `membership_types`
--

CREATE TABLE `membership_types` (
  `id` bigint UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` decimal(8,2) NOT NULL,
  `duration` int NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int UNSIGNED NOT NULL,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_reset_tokens_table', 1),
(3, '2019_08_19_000000_create_failed_jobs_table', 1),
(4, '2019_12_14_000001_create_personal_access_tokens_table', 1),
(5, '2023_06_19_041937_create_members_table', 1),
(6, '2023_06_22_115513_create_membership_types_table', 1),
(7, '2023_06_22_115521_create_memberships_table', 1),
(8, '2023_06_24_182202_create_settings_table', 1),
(9, '2023_06_27_085020_create_permission_tables', 1),
(10, '2023_08_04_125459_create_transactions_table', 1),
(11, '2023_08_20_133529_create_attendances_table', 1),
(12, '2023_09_09_132218_create_incomes_table', 1),
(13, '2023_09_11_074917_create_expenses_table', 1);

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

--
-- Table structure for table `model_has_permissions`
--

CREATE TABLE `model_has_permissions` (
  `permission_id` bigint UNSIGNED NOT NULL,
  `model_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `model_id` bigint UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `model_has_roles`
--

CREATE TABLE `model_has_roles` (
  `role_id` bigint UNSIGNED NOT NULL,
  `model_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `model_id` bigint UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `model_has_roles`
--

INSERT INTO `model_has_roles` (`role_id`, `model_type`, `model_id`) VALUES
(1, 'App\\Models\\User', 1);

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

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

CREATE TABLE `permissions` (
  `id` bigint UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `guard_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `permissions` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES
(1, 'member.index', 'web', '2024-08-24 08:50:42', '2024-08-24 08:50:42'),
(2, 'member.create', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(3, 'member.store', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(4, 'member.edit', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(5, 'member.update', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(6, 'member.destroy', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(7, 'plan.index', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(8, 'plan.create', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(9, 'plan.store', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(10, 'plan.edit', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(11, 'plan.update', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(12, 'plan.destroy', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(13, 'membership.index', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(14, 'membership.create', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(15, 'membership.store', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(16, 'attendance.index', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(17, 'attendance.create', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(18, 'attendance.store', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(19, 'attendance.update', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(20, 'attendance.manual', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(21, 'attendance.store_manual', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(22, 'transaction.index', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(23, 'transaction.create', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(24, 'transaction.store', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(25, 'transaction.edit', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(26, 'transaction.update', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(27, 'settings.index', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(28, 'settings.store', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(29, 'settings.update_logo', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(30, 'settings.remove_logo', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(31, 'reports.member_information', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(32, 'reports.payment_transactions', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(33, 'reports.attendance', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(34, 'income.index', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(35, 'income.create', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(36, 'income.store', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(37, 'income.edit', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(38, 'income.update', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(39, 'income.destroy', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(40, 'expense.index', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(41, 'expense.create', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(42, 'expense.store', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(43, 'expense.edit', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(44, 'expense.update', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(45, 'expense.destroy', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(46, 'user_role.index', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(47, 'user_role.create', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(48, 'user_role.store', 'web', '2024-08-24 08:50:43', '2024-08-24 08:50:43'),
(49, 'user_role.edit', 'web', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(50, 'user_role.update', 'web', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(51, 'user_role.destroy', 'web', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(52, 'user.index', 'web', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(53, 'user.create', 'web', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(54, 'user.store', 'web', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(55, 'user.edit', 'web', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(56, 'user.update', 'web', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(57, 'user.destroy', 'web', '2024-08-24 08:50:44', '2024-08-24 08:50:44');

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

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

CREATE TABLE `roles` (
  `id` bigint UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `guard_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `roles` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES
(1, 'Super Admin', 'web', '2024-08-24 08:50:44', '2024-08-24 08:50:44');

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

--
-- Table structure for table `role_has_permissions`
--

CREATE TABLE `role_has_permissions` (
  `permission_id` bigint UNSIGNED NOT NULL,
  `role_id` bigint UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `settings`
--

CREATE TABLE `settings` (
  `id` bigint UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `value` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `settings`
--

INSERT INTO `settings` (`id`, `name`, `value`, `created_at`, `updated_at`) VALUES
(1, 'brand_name', 'Casual Fitness', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(2, 'phone', '923132140179', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(3, 'email', 'info@casualfitness.com', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(4, 'currency', 'USD', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(5, 'country', 'Pakistan', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(6, 'address', 'Karachi, Gulistan-e-Johar', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(7, 'language', 'en', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(8, 'logo', 'default_logo.png', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(9, 'login_image', 'default_login_image.jpg', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(10, 'favicon', 'default_favicon.ico', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(11, 'date_format', 'd-m-Y', '2024-08-24 08:50:44', '2024-08-24 08:50:44'),
(12, 'timezone', 'Asia/Tokyo', '2024-08-24 08:50:44', '2024-08-24 08:50:44');

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

--
-- Table structure for table `transactions`
--

CREATE TABLE `transactions` (
  `id` bigint UNSIGNED NOT NULL,
  `transactionable_id` bigint UNSIGNED NOT NULL,
  `transactionable_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `fee` decimal(10,2) NOT NULL,
  `dr_cr` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `method` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `date` datetime NOT NULL,
  `created_user_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `note` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `transaction_details` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for dumped tables
--

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

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

--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

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

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

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

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

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

--
-- Indexes for table `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
  ADD KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`);

--
-- Indexes for table `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD PRIMARY KEY (`role_id`,`model_id`,`model_type`),
  ADD KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`);

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

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

--
-- Indexes for table `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`role_id`),
  ADD KEY `role_has_permissions_role_id_foreign` (`role_id`);

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

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

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `attendances`
--
ALTER TABLE `attendances`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `expenses`
--
ALTER TABLE `expenses`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `incomes`
--
ALTER TABLE `incomes`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `members`
--
ALTER TABLE `members`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `memberships`
--
ALTER TABLE `memberships`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `membership_types`
--
ALTER TABLE `membership_types`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=58;

--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `settings`
--
ALTER TABLE `settings`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `transactions`
--
ALTER TABLE `transactions`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;
COMMIT;

