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

START TRANSACTION;



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

--
-- Table structure for table `emploi_du_temps`
--

CREATE TABLE `emploi_du_temps` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `titre` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `matiere` varchar(255) NOT NULL,
  `groupe_id` bigint(20) UNSIGNED NOT NULL,
  `salle_id` bigint(20) UNSIGNED DEFAULT NULL,
  `debut` datetime NOT NULL,
  `fin` datetime NOT NULL,
  `jour_semaine` enum('lundi','mardi','mercredi','jeudi','vendredi','samedi','dimanche') NOT NULL,
  `est_recurrent` tinyint(1) NOT NULL DEFAULT 1,
  `est_annule` tinyint(1) NOT NULL DEFAULT 0,
  `couleur` varchar(7) NOT NULL DEFAULT '#3788d8',
  `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 `emploi_du_temps`
--

INSERT INTO `emploi_du_temps` (`id`, `titre`, `description`, `matiere`, `groupe_id`, `salle_id`, `debut`, `fin`, `jour_semaine`, `est_recurrent`, `est_annule`, `couleur`, `created_at`, `updated_at`) VALUES
(8, 'prog web', 'Cours magistral d\'analyse mathématique', 'prog', 1, 105, '2025-05-02 10:00:00', '2025-05-02 12:00:00', 'lundi', 1, 0, '#FF5733', '2025-05-02 15:47:29', '2025-05-05 13:31:00'),
(9, 'TP Communication', 'Travaux pratiques en expression orale', 'Expression orale', 1, 102, '2025-05-02 08:00:00', '2025-05-02 10:00:00', 'mardi', 1, 0, '#33C1FF', '2025-05-02 15:47:29', '2025-05-02 15:47:29'),
(10, 'Lab Prog I', 'Séance de laboratoire sur l\'électricité', 'Physique I', 1, 101, '2025-05-02 08:00:00', '2025-05-02 10:00:00', 'jeudi', 1, 0, '#3788d8', '2025-05-02 15:47:29', '2025-05-06 08:28:25'),
(11, 'Mathématiques II', 'Cours fondamental de maths pour ingénieurs', 'Math II', 3, 104, '2025-05-02 09:00:00', '2025-05-02 12:00:00', 'mardi', 1, 0, '#FFC300', '2025-05-02 15:47:29', '2025-05-02 15:47:29'),
(12, 'Calculus II', 'Exercices en salle', 'Calculus II', 1, 105, '2025-05-02 09:00:00', '2025-05-02 13:00:00', 'mercredi', 1, 0, '#DAF7A6', '2025-05-02 15:47:29', '2025-05-02 15:47:29'),
(13, 'Algo & Structures', 'Cours sur les algorithmes et structures de données', 'Structures de données', 1, 106, '2025-05-02 08:00:00', '2025-05-02 10:00:00', 'vendredi', 1, 0, '#C70039', '2025-05-02 15:47:29', '2025-05-02 15:47:29'),
(14, 'Développement Web', 'Introduction au web moderne', 'Web', 6, 107, '2025-05-02 15:00:00', '2025-05-02 18:00:00', 'jeudi', 1, 0, '#900C3F', '2025-05-02 15:47:29', '2025-05-02 15:47:29'),
(15, 'base de donees', 'tp2', 'base de donnees', 1, 107, '2025-05-02 12:00:00', '2025-05-02 14:00:00', 'vendredi', 1, 0, '#F44336', '2025-05-02 13:09:56', '2025-05-02 13:17:08'),
(17, 'tp', 'web', 'programmation web', 1, 105, '2025-05-02 12:15:00', '2025-05-02 14:15:00', 'jeudi', 1, 0, '#3788d8', '2025-05-02 14:23:30', '2025-05-02 14:23:30'),
(19, 'management', NULL, 'management', 1, 106, '2025-05-06 14:57:50', '2025-05-06 16:57:50', 'mercredi', 1, 0, '#3788d8', '2025-05-06 08:58:31', '2025-05-06 08:58:31');

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

--
-- Table structure for table `faculte`
--

CREATE TABLE `faculte` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `nombre_de_sallee` 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;

--
-- Dumping data for table `faculte`
--

INSERT INTO `faculte` (`id`, `name`, `nombre_de_sallee`, `created_at`, `updated_at`) VALUES
(1, 'Faculté d\'Ingénierie en Langues Étrangères', NULL, '2025-04-26 21:00:00', '2025-04-26 21:00:00');

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

--
-- Table structure for table `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;

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

--
-- Table structure for table `groupes`
--

CREATE TABLE `groupes` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `major_id` bigint(20) UNSIGNED NOT NULL,
  `noms` varchar(255) NOT NULL,
  `nombre` int(11) 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 `groupes`
--

INSERT INTO `groupes` (`id`, `major_id`, `noms`, `nombre`, `created_at`, `updated_at`) VALUES
(1, 1, '1230Fa', 1, '2025-04-26 21:00:00', '2025-04-26 21:00:00'),
(2, 2, '1231Fr', 1, '2025-04-26 21:00:00', '2025-04-26 21:00:00'),
(3, 3, '1232De', 1, '2025-04-26 21:00:00', '2025-04-26 21:00:00'),
(4, 4, '1233En', 1, '2025-04-26 21:00:00', '2025-04-26 21:00:00'),
(5, 5, '1234En', 1, '2025-04-26 21:00:00', '2025-04-26 21:00:00'),
(6, 6, '1235En', 1, '2025-04-26 21:00:00', '2025-04-26 21:00:00');

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

--
-- Table structure for table `jobs`
--

CREATE TABLE `jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `queue` varchar(255) NOT NULL,
  `payload` longtext NOT NULL,
  `attempts` tinyint(3) UNSIGNED NOT NULL,
  `reserved_at` int(10) UNSIGNED DEFAULT NULL,
  `available_at` int(10) UNSIGNED NOT NULL,
  `created_at` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `job_batches`
--

CREATE TABLE `job_batches` (
  `id` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `total_jobs` int(11) NOT NULL,
  `pending_jobs` int(11) NOT NULL,
  `failed_jobs` int(11) NOT NULL,
  `failed_job_ids` longtext NOT NULL,
  `options` mediumtext DEFAULT NULL,
  `cancelled_at` int(11) DEFAULT NULL,
  `created_at` int(11) NOT NULL,
  `finished_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `majors`
--

CREATE TABLE `majors` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `nomber` varchar(255) NOT NULL,
  `faculty_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;

--
-- Dumping data for table `majors`
--

INSERT INTO `majors` (`id`, `name`, `nomber`, `faculty_id`, `created_at`, `updated_at`) VALUES
(1, 'Informatique en anglais', '1', 1, '2025-04-26 21:00:00', '2025-04-26 21:00:00'),
(2, 'Informatique en français', '2', 1, '2025-04-26 21:00:00', '2025-04-26 21:00:00'),
(3, 'Informatique en allemand', '3', 1, '2025-04-26 21:00:00', '2025-04-26 21:00:00'),
(4, 'Génie électrique en anglais', '4', 1, '2025-04-26 21:00:00', '2025-04-26 21:00:00'),
(5, 'Génie mécanique en anglais', '5', 1, '2025-04-26 21:00:00', '2025-04-26 21:00:00'),
(6, 'Robotique en anglais', '6', 1, '2025-04-26 21:00:00', '2025-04-26 21:00:00');

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

--
-- Table structure for table `major_salle`
--

CREATE TABLE `major_salle` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `major_id` bigint(20) UNSIGNED NOT NULL,
  `salle_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;

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

--
-- Table structure for table `messages`
--

CREATE TABLE `messages` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sender_id` varchar(255) NOT NULL,
  `receiver_id` varchar(255) NOT NULL,
  `content` text NOT NULL,
  `is_read` 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;

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

--
-- Table structure for table `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;

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

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '0001_01_01_000000_create_users_table', 1),
(2, '0001_01_01_000001_create_cache_table', 1),
(3, '0001_01_01_000002_create_jobs_table', 1),
(4, '2025_04_23_125208_create_faculte_table', 1),
(5, '2025_04_23_125536_create_salle_table', 1),
(6, '2025_04_23_125926_create_majors_table', 1),
(7, '2025_04_23_130101_create_major_salle_table', 1),
(8, '2025_04_23_130237_create_groupes_table', 1),
(9, '2025_04_23_130402_create_roles_table', 1),
(10, '2025_04_23_130533_add_role_id_to_users_table', 1),
(11, '2025_04_23_140147_create_oauth_auth_codes_table', 1),
(12, '2025_04_23_140148_create_oauth_access_tokens_table', 1),
(13, '2025_04_23_140149_create_oauth_refresh_tokens_table', 1),
(14, '2025_04_23_140150_create_oauth_clients_table', 1),
(15, '2025_04_23_140151_create_oauth_personal_access_clients_table', 1),
(16, '2025_04_27_182438_add_major_id_to_groupes_table', 1),
(17, '2025_04_27_182817_add_groupe_id_to_users_table', 1),
(18, '2025_04_29_000000_create_emploi_du_temps_table', 1),
(19, '2025_05_02_152204_remove_professeur_id_from_emploi_du_temps', 2),
(20, '2025_04_30_000000_remove_professeur_id_from_emploi_du_temps', 3),
(21, '2025_05_01_000000_create_professeur_cours_table', 4),
(22, '2025_05_02_000000_create_notifications_table', 5),
(23, '2025_05_02_165536_add_major_id_to_notifications_table', 6),
(24, '2025_05_02_000000_create_occupations_bureaux_table', 7),
(25, '2025_05_04_100920_add_profile_fields_to_users_table', 8),
(26, '2025_05_04_105941_create_notification_documents_table', 9),
(27, '2025_05_04_110316_remove_notification_documents_table', 10),
(28, '2025_05_04_110931_add_coordinates_to_salle_table', 11),
(29, '2025_05_04_130152_add_openstreetmap_url_to_salle_table', 12),
(30, '2023_05_06_000000_add_preferred_language_to_users_table', 13),
(31, '2024_03_21_create_messages_table', 14),
(32, '2025_05_10_114200_create_device_tokens_table', 15);

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

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

CREATE TABLE `notifications` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `titre` varchar(255) NOT NULL,
  `message` text NOT NULL,
  `groupe_id` bigint(20) UNSIGNED DEFAULT NULL,
  `major_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('info','important','urgent') NOT NULL DEFAULT 'info',
  `est_lue` tinyint(1) NOT NULL DEFAULT 0,
  `date_expiration` datetime DEFAULT 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 `notifications`
--

INSERT INTO `notifications` (`id`, `titre`, `message`, `groupe_id`, `major_id`, `user_id`, `type`, `est_lue`, `date_expiration`, `created_at`, `updated_at`) VALUES
(1, 'Test Notification', 'Ceci est un test de notification.', NULL, NULL, 2, 'info', 0, '2025-12-31 00:00:00', '2025-05-12 10:15:05', '2025-05-12 10:15:05'),
(8, 'examen bd', 'le 22 juin a 10h dans la salle cb 105', 1, NULL, 3, 'info', 0, NULL, '2025-05-12 11:27:33', '2025-05-12 11:27:33');

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

--
-- Table structure for table `notification_documents`
--

CREATE TABLE `notification_documents` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `notification_id` bigint(20) UNSIGNED NOT NULL,
  `nom_fichier` varchar(255) NOT NULL,
  `type_fichier` varchar(255) NOT NULL,
  `chemin_fichier` varchar(255) NOT NULL,
  `taille` int(11) NOT NULL COMMENT 'Taille en Ko',
  `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 `oauth_auth_codes`
--

CREATE TABLE `oauth_auth_codes` (
  `id` varchar(100) NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `client_id` bigint(20) UNSIGNED NOT NULL,
  `scopes` text DEFAULT NULL,
  `revoked` tinyint(1) NOT NULL,
  `expires_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `oauth_personal_access_clients`
--

CREATE TABLE `oauth_personal_access_clients` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `client_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;

--
-- Dumping data for table `oauth_personal_access_clients`
--

INSERT INTO `oauth_personal_access_clients` (`id`, `client_id`, `created_at`, `updated_at`) VALUES
(1, 1, '2025-05-02 12:07:31', '2025-05-02 12:07:31');

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

--
-- Table structure for table `occupations_bureaux`
--

CREATE TABLE `occupations_bureaux` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `titre` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `activite` varchar(255) NOT NULL,
  `nombre_personnes` int(11) NOT NULL DEFAULT 1,
  `debut` datetime NOT NULL,
  `fin` datetime NOT NULL,
  `bureau` varchar(255) NOT NULL,
  `jour_semaine` enum('lundi','mardi','mercredi','jeudi','vendredi','samedi','dimanche') NOT NULL,
  `est_recurrent` tinyint(1) NOT NULL DEFAULT 0,
  `est_annule` tinyint(1) NOT NULL DEFAULT 0,
  `couleur` varchar(7) NOT NULL DEFAULT '#4CAF50',
  `user_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;

--
-- Dumping data for table `occupations_bureaux`
--

INSERT INTO `occupations_bureaux` (`id`, `titre`, `description`, `activite`, `nombre_personnes`, `debut`, `fin`, `bureau`, `jour_semaine`, `est_recurrent`, `est_annule`, `couleur`, `user_id`, `created_at`, `updated_at`) VALUES
(2, 'Session de travail personnel', 'Préparation rapport final', 'Travail personnel', 10, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'Bureau 101', 'mercredi', 0, 0, '#33FFAA', 2, '2025-05-03 10:33:11', '2025-05-03 10:33:11'),
(4, 'Session de travail personnel', 'Préparation rapport final', 'Travail personnel', 1, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'Bureau 101', 'mercredi', 0, 0, '#33FFAA', 2, '2025-05-03 10:33:11', '2025-05-03 10:33:11');

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

--
-- Table structure for table `professeur_cours`
--

CREATE TABLE `professeur_cours` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `emploi_du_temps_id` bigint(20) UNSIGNED NOT NULL,
  `est_principal` tinyint(1) NOT NULL DEFAULT 1,
  `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 `professeur_cours`
--

INSERT INTO `professeur_cours` (`id`, `user_id`, `emploi_du_temps_id`, `est_principal`, `created_at`, `updated_at`) VALUES
(1, 3, 8, 1, '2025-05-02 15:59:03', '2025-05-02 15:59:03'),
(2, 6, 9, 0, '2025-05-02 15:59:03', '2025-05-02 15:59:03'),
(3, 3, 10, 1, '2025-05-02 15:59:03', '2025-05-02 15:59:03'),
(4, 6, 15, 1, '2025-05-02 13:09:56', '2025-05-02 13:09:56'),
(6, 3, 17, 1, '2025-05-02 14:23:30', '2025-05-02 14:23:30'),
(8, 6, 19, 1, '2025-05-06 08:58:31', '2025-05-06 08:58:31');

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

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

CREATE TABLE `roles` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `nom` 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;

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

INSERT INTO `roles` (`id`, `nom`, `created_at`, `updated_at`) VALUES
(4, 'student', '2025-05-02 12:14:07', '2025-05-02 12:14:07'),
(5, 'prof', '2025-05-02 12:14:07', '2025-05-02 12:14:07'),
(6, 'admin', '2025-05-02 12:14:07', '2025-05-02 12:14:07');

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

--
-- Table structure for table `salle`
--

CREATE TABLE `salle` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `nom` varchar(255) NOT NULL,
  `faculte_id` bigint(20) UNSIGNED NOT NULL,
  `nombre_d_etudiant` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `latitude` decimal(10,7) DEFAULT NULL,
  `longitude` decimal(10,7) DEFAULT NULL,
  `google_maps_url` varchar(255) DEFAULT NULL,
  `openstreetmap_url` varchar(255) DEFAULT NULL,
  `frequentation` int(11) NOT NULL DEFAULT 0,
  `code_batiment` varchar(255) DEFAULT NULL,
  `etage` int(11) NOT NULL DEFAULT 0,
  `points_repere` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `salle`
--

INSERT INTO `salle` (`id`, `nom`, `faculte_id`, `nombre_d_etudiant`, `created_at`, `updated_at`, `latitude`, `longitude`, `google_maps_url`, `openstreetmap_url`, `frequentation`, `code_batiment`, `etage`, `points_repere`) VALUES
(101, 'AN204', 1, 30, '2025-05-02 15:02:23', '2025-05-02 15:02:23', NULL, NULL, NULL, NULL, 0, NULL, 0, NULL),
(102, 'CB020', 1, 28, '2025-05-02 15:02:23', '2025-05-02 15:02:23', NULL, NULL, NULL, NULL, 0, NULL, 0, NULL),
(103, 'B028b', 1, 25, '2025-05-02 15:02:23', '2025-05-02 15:02:23', NULL, NULL, NULL, NULL, 0, NULL, 0, NULL),
(104, 'CJ103', 1, 32, '2025-05-02 15:02:23', '2025-05-02 15:02:23', NULL, NULL, NULL, NULL, 0, NULL, 0, NULL),
(105, 'CJ101', 1, 30, '2025-05-02 15:02:23', '2025-05-02 15:02:23', NULL, NULL, NULL, NULL, 0, NULL, 0, NULL),
(106, 'CJ104', 1, 26, '2025-05-02 15:02:23', '2025-05-02 15:02:23', NULL, NULL, NULL, NULL, 0, NULL, 0, NULL),
(107, 'CJ201', 1, 35, '2025-05-02 15:02:23', '2025-05-02 15:02:23', NULL, NULL, NULL, NULL, 0, NULL, 0, NULL);

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

--
-- Table structure for table `sessions`
--

CREATE TABLE `sessions` (
  `id` varchar(255) NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `payload` longtext NOT NULL,
  `last_activity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for table `emploi_du_temps`
--
ALTER TABLE `emploi_du_temps`
  ADD PRIMARY KEY (`id`),
  ADD KEY `emploi_du_temps_groupe_id_foreign` (`groupe_id`),
  ADD KEY `emploi_du_temps_salle_id_foreign` (`salle_id`);

--
-- Indexes for table `faculte`
--
ALTER TABLE `faculte`
  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 `groupes`
--
ALTER TABLE `groupes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `groupes_major_id_foreign` (`major_id`);

--
-- Indexes for table `jobs`
--
ALTER TABLE `jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `jobs_queue_index` (`queue`);

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

--
-- Indexes for table `majors`
--
ALTER TABLE `majors`
  ADD PRIMARY KEY (`id`),
  ADD KEY `majors_faculty_id_foreign` (`faculty_id`);

--
-- Indexes for table `major_salle`
--
ALTER TABLE `major_salle`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `major_salle_major_id_salle_id_unique` (`major_id`,`salle_id`),
  ADD KEY `major_salle_salle_id_foreign` (`salle_id`);

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

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

--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `notifications_groupe_id_foreign` (`groupe_id`),
  ADD KEY `notifications_user_id_foreign` (`user_id`),
  ADD KEY `notifications_major_id_foreign` (`major_id`);

--
-- Indexes for table `notification_documents`
--
ALTER TABLE `notification_documents`
  ADD PRIMARY KEY (`id`),
  ADD KEY `notification_documents_notification_id_foreign` (`notification_id`);

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

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

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

--
-- Indexes for table `professeur_cours`
--
ALTER TABLE `professeur_cours`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `professeur_cours_user_id_emploi_du_temps_id_unique` (`user_id`,`emploi_du_temps_id`),
  ADD KEY `professeur_cours_emploi_du_temps_id_foreign` (`emploi_du_temps_id`);

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

--
-- Indexes for table `salle`
--
ALTER TABLE `salle`
  ADD PRIMARY KEY (`id`),
  ADD KEY `salle_faculte_id_foreign` (`faculte_id`);

--
-- Indexes for table `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

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

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

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

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

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

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

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

--
-- AUTO_INCREMENT for table `messages`
--
ALTER TABLE `messages`
  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=33;

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

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

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

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

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

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

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

--
-- Constraints for table `emploi_du_temps`
--
ALTER TABLE `emploi_du_temps`
  ADD CONSTRAINT `emploi_du_temps_groupe_id_foreign` FOREIGN KEY (`groupe_id`) REFERENCES `groupes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `emploi_du_temps_salle_id_foreign` FOREIGN KEY (`salle_id`) REFERENCES `salle` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `groupes`
--
ALTER TABLE `groupes`
  ADD CONSTRAINT `groupes_major_id_foreign` FOREIGN KEY (`major_id`) REFERENCES `majors` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `majors`
--
ALTER TABLE `majors`
  ADD CONSTRAINT `majors_faculty_id_foreign` FOREIGN KEY (`faculty_id`) REFERENCES `faculte` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `major_salle`
--
ALTER TABLE `major_salle`
  ADD CONSTRAINT `major_salle_major_id_foreign` FOREIGN KEY (`major_id`) REFERENCES `majors` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `major_salle_salle_id_foreign` FOREIGN KEY (`salle_id`) REFERENCES `salle` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `notifications`
--
ALTER TABLE `notifications`
  ADD CONSTRAINT `notifications_groupe_id_foreign` FOREIGN KEY (`groupe_id`) REFERENCES `groupes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `notifications_major_id_foreign` FOREIGN KEY (`major_id`) REFERENCES `majors` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `notifications_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `notification_documents`
--
ALTER TABLE `notification_documents`
  ADD CONSTRAINT `notification_documents_notification_id_foreign` FOREIGN KEY (`notification_id`) REFERENCES `notifications` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `occupations_bureaux`
--
ALTER TABLE `occupations_bureaux`
  ADD CONSTRAINT `occupations_bureaux_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `professeur_cours`
--
ALTER TABLE `professeur_cours`
  ADD CONSTRAINT `professeur_cours_emploi_du_temps_id_foreign` FOREIGN KEY (`emploi_du_temps_id`) REFERENCES `emploi_du_temps` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `professeur_cours_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `salle`
--
ALTER TABLE `salle`
  ADD CONSTRAINT `salle_faculte_id_foreign` FOREIGN KEY (`faculte_id`) REFERENCES `faculte` (`id`) ON DELETE CASCADE;
COMMIT;

