-- https://www.phpmyadmin.net/
--
-- إصدار الخادم: 10.4.28-MariaDB

START TRANSACTION;



--
-- Database: `namat`
--

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

--
-- بنية الجدول `cities`
--

CREATE TABLE `cities` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`name`)),
  `state_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- إرجاع أو استيراد بيانات الجدول `cities`
--

INSERT INTO `cities` (`id`, `name`, `state_id`, `created_at`, `updated_at`) VALUES
(1, '{\"ar\":\"مدينة نصر\",\"en\":\"Nasr City\"}', 1, '2025-05-08 16:55:30', '2025-05-08 16:55:30'),
(2, '{\"ar\":\"الزمالك\",\"en\":\"Zamalek\"}', 1, '2025-05-08 16:55:31', '2025-05-08 16:55:31'),
(3, '{\"ar\":\"الملز\",\"en\":\"Olaya\"}', 4, '2025-05-08 16:55:31', '2025-05-08 16:55:31'),
(4, '{\"ar\":\"الخبر\",\"en\":\"Al-Khobar\"}', 4, '2025-05-08 16:55:31', '2025-05-08 16:55:31'),
(5, '{\"ar\":\"الخليج الغربي\",\"en\":\"West Bay\"}', 13, '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(6, '{\"ar\":\"السد\",\"en\":\"Al Sadd\"}', 13, '2025-05-08 16:55:33', '2025-05-08 16:55:33');

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

--
-- بنية الجدول `classrooms`
--

CREATE TABLE `classrooms` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`name`)),
  `grade_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- بنية الجدول `countries`
--

CREATE TABLE `countries` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`name`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- إرجاع أو استيراد بيانات الجدول `countries`
--

INSERT INTO `countries` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, '{\"ar\":\"مصر\",\"en\":\"Egypt\"}', '2025-05-08 16:55:30', '2025-05-08 16:55:30'),
(2, '{\"ar\":\"السعودية\",\"en\":\"Saudi Arabia\"}', '2025-05-08 16:55:31', '2025-05-08 16:55:31'),
(3, '{\"ar\":\"الإمارات\",\"en\":\"United Arab Emirates\"}', '2025-05-08 16:55:32', '2025-05-08 16:55:32'),
(4, '{\"ar\":\"الأردن\",\"en\":\"Jordan\"}', '2025-05-08 16:55:32', '2025-05-08 16:55:32'),
(5, '{\"ar\":\"لبنان\",\"en\":\"Lebanon\"}', '2025-05-08 16:55:32', '2025-05-08 16:55:32'),
(6, '{\"ar\":\"الجزائر\",\"en\":\"Algeria\"}', '2025-05-08 16:55:32', '2025-05-08 16:55:32'),
(7, '{\"ar\":\"المغرب\",\"en\":\"Morocco\"}', '2025-05-08 16:55:32', '2025-05-08 16:55:32'),
(8, '{\"ar\":\"تونس\",\"en\":\"Tunisia\"}', '2025-05-08 16:55:32', '2025-05-08 16:55:32'),
(9, '{\"ar\":\"العراق\",\"en\":\"Iraq\"}', '2025-05-08 16:55:32', '2025-05-08 16:55:32'),
(10, '{\"ar\":\"الكويت\",\"en\":\"Kuwait\"}', '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(11, '{\"ar\":\"عمان\",\"en\":\"Oman\"}', '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(12, '{\"ar\":\"قطر\",\"en\":\"Qatar\"}', '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(13, '{\"ar\":\"البحرين\",\"en\":\"Bahrain\"}', '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(14, '{\"ar\":\"فلسطين\",\"en\":\"Palestine\"}', '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(15, '{\"ar\":\"سوريا\",\"en\":\"Syria\"}', '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(16, '{\"ar\":\"اليمن\",\"en\":\"Yemen\"}', '2025-05-08 16:55:33', '2025-05-08 16:55:33');

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

--
-- بنية الجدول `exams`
--

CREATE TABLE `exams` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `lesson_id` bigint(20) UNSIGNED NOT NULL,
  `title` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`title`)),
  `description` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`description`)),
  `min_time` int(11) DEFAULT NULL,
  `max_time` int(11) DEFAULT NULL,
  `average_time` int(11) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- بنية الجدول `failed_jobs`
--

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

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

--
-- بنية الجدول `grades`
--

CREATE TABLE `grades` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`name`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- بنية الجدول `heard_about_us`
--

CREATE TABLE `heard_about_us` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`name`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- إرجاع أو استيراد بيانات الجدول `heard_about_us`
--

INSERT INTO `heard_about_us` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, '{\"en\":\"Social Media\",\"ar\":\"وسائل التواصل الاجتماعي\"}', '2025-05-08 16:55:30', '2025-05-08 16:55:30'),
(2, '{\"en\":\"Referral\",\"ar\":\"إحالة\"}', '2025-05-08 16:55:30', '2025-05-08 16:55:30'),
(3, '{\"en\":\"Advertisement\",\"ar\":\"إعلان\"}', '2025-05-08 16:55:30', '2025-05-08 16:55:30'),
(4, '{\"en\":\"Search Engine\",\"ar\":\"محرك البحث\"}', '2025-05-08 16:55:30', '2025-05-08 16:55:30'),
(5, '{\"en\":\"Friend\",\"ar\":\"صديق\"}', '2025-05-08 16:55:30', '2025-05-08 16:55:30'),
(6, '{\"en\":\"Other\",\"ar\":\"آخر\"}', '2025-05-08 16:55:30', '2025-05-08 16:55:30');

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

--
-- بنية الجدول `lessons`
--

CREATE TABLE `lessons` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `title` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`title`)),
  `content` text DEFAULT NULL,
  `unit_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- بنية الجدول `migrations`
--

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

--
-- إرجاع أو استيراد بيانات الجدول `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, '2014_10_12_100000_create_password_resets_table', 1),
(4, '2019_08_19_000000_create_failed_jobs_table', 1),
(5, '2019_12_14_000001_create_personal_access_tokens_table', 1),
(6, '2025_01_31_195147_create_countries_table', 1),
(7, '2025_01_31_195616_create_states_table', 1),
(8, '2025_01_31_195637_create_cities_table', 1),
(9, '2025_02_02_191822_create_grades_table', 1),
(10, '2025_02_03_071947_create_classrooms_table', 1),
(11, '2025_02_04_080855_create_subjects_table', 1),
(12, '2025_02_07_092308_create_semesters_table', 1),
(13, '2025_02_08_144742_create_heard_about_us_table', 1),
(14, '2025_02_08_152738_create_students_table', 1),
(15, '2025_02_10_194831_create_units_table', 1),
(16, '2025_02_12_094201_create_lessons_table', 1),
(17, '2025_02_12_203148_create_exams_table', 1),
(18, '2025_02_15_065101_create_question_groups_table', 1),
(19, '2025_02_18_083214_create_questions_table', 1),
(20, '2025_02_22_093542_create_question_choices_table', 1),
(21, '2025_02_22_093706_create_question_essay_answers_table', 1);

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

--
-- بنية الجدول `questions`
--

CREATE TABLE `questions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `exam_id` bigint(20) UNSIGNED NOT NULL,
  `group_id` bigint(20) UNSIGNED NOT NULL,
  `question_text` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`question_text`)),
  `question_type` varchar(255) NOT NULL,
  `marks` int(11) NOT NULL,
  `video` varchar(255) DEFAULT NULL,
  `is_resolve` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- بنية الجدول `question_choices`
--

CREATE TABLE `question_choices` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `question_id` bigint(20) UNSIGNED NOT NULL,
  `choice_text` varchar(255) NOT NULL,
  `is_correct` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- بنية الجدول `question_essay_answers`
--

CREATE TABLE `question_essay_answers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `question_id` bigint(20) UNSIGNED NOT NULL,
  `user_answer` text NOT NULL,
  `correct_answer` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- بنية الجدول `question_groups`
--

CREATE TABLE `question_groups` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`name`)),
  `description` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`description`)),
  `subject_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- بنية الجدول `semesters`
--

CREATE TABLE `semesters` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`name`)),
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `subject_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- بنية الجدول `states`
--

CREATE TABLE `states` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`name`)),
  `country_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- إرجاع أو استيراد بيانات الجدول `states`
--

INSERT INTO `states` (`id`, `name`, `country_id`, `created_at`, `updated_at`) VALUES
(1, '{\"ar\":\"القاهرة\",\"en\":\"Cairo\"}', 1, '2025-05-08 16:55:30', '2025-05-08 16:55:30'),
(2, '{\"ar\":\"الإسكندرية\",\"en\":\"Alexandria\"}', 1, '2025-05-08 16:55:31', '2025-05-08 16:55:31'),
(3, '{\"ar\":\"الجيزة\",\"en\":\"Giza\"}', 1, '2025-05-08 16:55:31', '2025-05-08 16:55:31'),
(4, '{\"ar\":\"الرياض\",\"en\":\"Riyadh\"}', 2, '2025-05-08 16:55:31', '2025-05-08 16:55:31'),
(5, '{\"ar\":\"جدة\",\"en\":\"Jeddah\"}', 2, '2025-05-08 16:55:31', '2025-05-08 16:55:31'),
(6, '{\"ar\":\"مكة\",\"en\":\"Mecca\"}', 2, '2025-05-08 16:55:32', '2025-05-08 16:55:32'),
(7, '{\"ar\":\"دبي\",\"en\":\"Dubai\"}', 3, '2025-05-08 16:55:32', '2025-05-08 16:55:32'),
(8, '{\"ar\":\"أبوظبي\",\"en\":\"Abu Dhabi\"}', 3, '2025-05-08 16:55:32', '2025-05-08 16:55:32'),
(9, '{\"ar\":\"الشارقة\",\"en\":\"Sharjah\"}', 3, '2025-05-08 16:55:32', '2025-05-08 16:55:32'),
(10, '{\"ar\":\"مسقط\",\"en\":\"Muscat\"}', 11, '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(11, '{\"ar\":\"ظفار\",\"en\":\"Dhofar\"}', 11, '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(12, '{\"ar\":\"الباطنة شمال\",\"en\":\"North Batinah\"}', 11, '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(13, '{\"ar\":\"الدوحة\",\"en\":\"Doha\"}', 12, '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(14, '{\"ar\":\"الريان\",\"en\":\"Al Rayyan\"}', 12, '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(15, '{\"ar\":\"الخور\",\"en\":\"Al Khor\"}', 12, '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(16, '{\"ar\":\"المنامة\",\"en\":\"Manama\"}', 13, '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(17, '{\"ar\":\"المحرق\",\"en\":\"Muharraq\"}', 13, '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(18, '{\"ar\":\"رام الله\",\"en\":\"Ramallah\"}', 14, '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(19, '{\"ar\":\"غزة\",\"en\":\"Gaza\"}', 14, '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(20, '{\"ar\":\"دمشق\",\"en\":\"Damascus\"}', 15, '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(21, '{\"ar\":\"حلب\",\"en\":\"Aleppo\"}', 15, '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(22, '{\"ar\":\"صنعاء\",\"en\":\"Sanaa\"}', 16, '2025-05-08 16:55:33', '2025-05-08 16:55:33'),
(23, '{\"ar\":\"عدن\",\"en\":\"Aden\"}', 16, '2025-05-08 16:55:33', '2025-05-08 16:55:33');

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

--
-- بنية الجدول `subjects`
--

CREATE TABLE `subjects` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`name`)),
  `grade_id` bigint(20) UNSIGNED NOT NULL,
  `classroom_id` bigint(20) UNSIGNED NOT NULL,
  `price` decimal(5,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- بنية الجدول `units`
--

CREATE TABLE `units` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`name`)),
  `info` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`info`)),
  `semester_id` bigint(20) UNSIGNED NOT 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 `cities`
--
ALTER TABLE `cities`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cities_state_id_foreign` (`state_id`);

--
-- Indexes for table `classrooms`
--
ALTER TABLE `classrooms`
  ADD PRIMARY KEY (`id`),
  ADD KEY `classrooms_grade_id_foreign` (`grade_id`);

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

--
-- Indexes for table `exams`
--
ALTER TABLE `exams`
  ADD PRIMARY KEY (`id`),
  ADD KEY `exams_lesson_id_foreign` (`lesson_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 `grades`
--
ALTER TABLE `grades`
  ADD PRIMARY KEY (`id`);

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

--
-- Indexes for table `lessons`
--
ALTER TABLE `lessons`
  ADD PRIMARY KEY (`id`),
  ADD KEY `lessons_unit_id_foreign` (`unit_id`);

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

--
-- Indexes for table `questions`
--
ALTER TABLE `questions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `questions_exam_id_foreign` (`exam_id`),
  ADD KEY `questions_group_id_foreign` (`group_id`);

--
-- Indexes for table `question_choices`
--
ALTER TABLE `question_choices`
  ADD PRIMARY KEY (`id`),
  ADD KEY `question_choices_question_id_foreign` (`question_id`);

--
-- Indexes for table `question_essay_answers`
--
ALTER TABLE `question_essay_answers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `question_essay_answers_question_id_foreign` (`question_id`);

--
-- Indexes for table `question_groups`
--
ALTER TABLE `question_groups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `question_groups_subject_id_foreign` (`subject_id`);

--
-- Indexes for table `semesters`
--
ALTER TABLE `semesters`
  ADD PRIMARY KEY (`id`),
  ADD KEY `semesters_subject_id_foreign` (`subject_id`);

--
-- Indexes for table `states`
--
ALTER TABLE `states`
  ADD PRIMARY KEY (`id`),
  ADD KEY `states_country_id_foreign` (`country_id`);

--
-- Indexes for table `subjects`
--
ALTER TABLE `subjects`
  ADD PRIMARY KEY (`id`),
  ADD KEY `subjects_grade_id_foreign` (`grade_id`),
  ADD KEY `subjects_classroom_id_foreign` (`classroom_id`);

--
-- Indexes for table `units`
--
ALTER TABLE `units`
  ADD PRIMARY KEY (`id`),
  ADD KEY `units_semester_id_foreign` (`semester_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `cities`
--
ALTER TABLE `cities`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `classrooms`
--
ALTER TABLE `classrooms`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `countries`
--
ALTER TABLE `countries`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `exams`
--
ALTER TABLE `exams`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `grades`
--
ALTER TABLE `grades`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `heard_about_us`
--
ALTER TABLE `heard_about_us`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `lessons`
--
ALTER TABLE `lessons`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;

--
-- AUTO_INCREMENT for table `questions`
--
ALTER TABLE `questions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `question_choices`
--
ALTER TABLE `question_choices`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `question_essay_answers`
--
ALTER TABLE `question_essay_answers`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `question_groups`
--
ALTER TABLE `question_groups`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `semesters`
--
ALTER TABLE `semesters`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `states`
--
ALTER TABLE `states`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;

--
-- AUTO_INCREMENT for table `subjects`
--
ALTER TABLE `subjects`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `units`
--
ALTER TABLE `units`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- قيود الجداول المُلقاة.
--

--
-- قيود الجداول `cities`
--
ALTER TABLE `cities`
  ADD CONSTRAINT `cities_state_id_foreign` FOREIGN KEY (`state_id`) REFERENCES `states` (`id`) ON DELETE CASCADE;

--
-- قيود الجداول `classrooms`
--
ALTER TABLE `classrooms`
  ADD CONSTRAINT `classrooms_grade_id_foreign` FOREIGN KEY (`grade_id`) REFERENCES `grades` (`id`) ON DELETE CASCADE;

--
-- قيود الجداول `exams`
--
ALTER TABLE `exams`
  ADD CONSTRAINT `exams_lesson_id_foreign` FOREIGN KEY (`lesson_id`) REFERENCES `lessons` (`id`) ON DELETE CASCADE;

--
-- قيود الجداول `lessons`
--
ALTER TABLE `lessons`
  ADD CONSTRAINT `lessons_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE CASCADE;

--
-- قيود الجداول `questions`
--
ALTER TABLE `questions`
  ADD CONSTRAINT `questions_exam_id_foreign` FOREIGN KEY (`exam_id`) REFERENCES `exams` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `questions_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `question_groups` (`id`) ON DELETE CASCADE;

--
-- قيود الجداول `question_choices`
--
ALTER TABLE `question_choices`
  ADD CONSTRAINT `question_choices_question_id_foreign` FOREIGN KEY (`question_id`) REFERENCES `questions` (`id`) ON DELETE CASCADE;

--
-- قيود الجداول `question_essay_answers`
--
ALTER TABLE `question_essay_answers`
  ADD CONSTRAINT `question_essay_answers_question_id_foreign` FOREIGN KEY (`question_id`) REFERENCES `questions` (`id`) ON DELETE CASCADE;

--
-- قيود الجداول `question_groups`
--
ALTER TABLE `question_groups`
  ADD CONSTRAINT `question_groups_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE;

--
-- قيود الجداول `semesters`
--
ALTER TABLE `semesters`
  ADD CONSTRAINT `semesters_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE;

--
-- قيود الجداول `states`
--
ALTER TABLE `states`
  ADD CONSTRAINT `states_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`) ON DELETE CASCADE;

--
-- قيود الجداول `subjects`
--
ALTER TABLE `subjects`
  ADD CONSTRAINT `subjects_classroom_id_foreign` FOREIGN KEY (`classroom_id`) REFERENCES `classrooms` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `subjects_grade_id_foreign` FOREIGN KEY (`grade_id`) REFERENCES `grades` (`id`) ON DELETE CASCADE;

--
-- قيود الجداول `units`
--
ALTER TABLE `units`
  ADD CONSTRAINT `units_semester_id_foreign` FOREIGN KEY (`semester_id`) REFERENCES `semesters` (`id`) ON DELETE CASCADE;
COMMIT;

