-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1
-- Généré le : mar. 09 juil. 2024 à 13:47
-- Version du serveur : 10.4.25-MariaDB
-- Version de PHP : 8.1.10

START TRANSACTION;



--
-- Base de données : `aps`
--

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

--
-- Structure de la table `categories`
--

CREATE TABLE `categories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `nom` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `image` 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;

--
-- Déchargement des données de la table `categories`
--

INSERT INTO `categories` (`id`, `nom`, `image`, `created_at`, `updated_at`) VALUES
(1, 'Batiment', '1716223811.jpg', '2024-05-20 16:50:11', '2024-05-20 16:50:11'),
(2, 'Batiment', '1716491726.jpg', '2024-05-23 19:15:26', '2024-05-23 19:15:26'),
(3, 'Batiment', '1716491733.jpg', '2024-05-23 19:15:33', '2024-05-23 19:15:33'),
(4, 'Batiment', '1716491739.jpg', '2024-05-23 19:15:39', '2024-05-23 19:15:39'),
(5, 'Batiment', '1716491746.jpg', '2024-05-23 19:15:46', '2024-05-23 19:15:46'),
(6, 'Batiment', '1716491753.jpg', '2024-05-23 19:15:53', '2024-05-23 19:15:53'),
(7, 'Batiment', '1716491761.jpg', '2024-05-23 19:16:01', '2024-05-23 19:16:01');

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

--
-- Structure de la table `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint(20) 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;

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

--
-- Structure de la table `migrations`
--

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

--
-- Déchargement des données de la 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, '2024_05_12_215901_create_categories_table', 1),
(6, '2024_05_19_201337_create_sous_categories_table', 1),
(7, '2024_05_19_201357_create_ouvriers_table', 1),
(8, '2024_05_19_201420_create_clients_table', 1),
(9, '2024_05_19_201439_create_reservations_table', 1),
(11, '2024_05_19_201513_create_notations_table', 2),
(12, '2024_05_28_120840_update_table_add_column_to_ouvriers_table', 3),
(13, '2024_05_28_120903_update_table_add_column_to_clients_table', 3),
(14, '2024_06_05_221826_add_column_etat_to_ouvriers_table', 4),
(15, '2024_06_06_155207_add_column_noter_to_reservations_table', 5),
(16, '2024_07_07_133210_add_column_note_to_reservations_table', 6);

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

--
-- Structure de la table `notations`
--

CREATE TABLE `notations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `note` double NOT NULL,
  `reservation_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;

--
-- Déchargement des données de la table `notations`
--

INSERT INTO `notations` (`id`, `note`, `reservation_id`, `created_at`, `updated_at`) VALUES
(1, 4, 1, '2024-05-27 16:50:25', '2024-05-27 16:50:25'),
(3, 3, 2, '2024-06-06 15:56:13', '2024-06-06 15:56:13'),
(4, 4, 1, '2024-06-06 17:48:43', '2024-06-06 17:48:43'),
(5, 4, 3, '2024-06-07 16:13:58', '2024-06-07 16:13:58'),
(6, 4, 4, '2024-06-10 17:10:21', '2024-06-10 17:10:21'),
(7, 4, 4, '2024-07-06 22:59:56', '2024-07-06 22:59:56'),
(8, 4, 4, '2024-07-07 13:40:24', '2024-07-07 13:40:24');

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

--
-- Structure de la table `reservations`
--

CREATE TABLE `reservations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `etat` tinyint(1) NOT NULL DEFAULT 0,
  `dater` date DEFAULT NULL,
  `client_id` bigint(20) UNSIGNED NOT NULL,
  `ouvrier_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `noter` tinyint(1) NOT NULL DEFAULT 0,
  `note` double DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Déchargement des données de la table `reservations`
--

INSERT INTO `reservations` (`id`, `etat`, `dater`, `client_id`, `ouvrier_id`, `created_at`, `updated_at`, `noter`, `note`) VALUES
(1, 1, '2024-05-30', 1, 1, '2024-05-26 21:13:31', '2024-06-06 17:48:43', 1, 5),
(2, 1, '2024-05-23', 1, 1, '2024-05-31 21:12:02', '2024-06-06 15:56:13', 1, 4),
(3, 1, '2024-06-13', 1, 1, '2024-06-06 22:36:24', '2024-06-07 16:22:41', 1, 3),
(4, 1, '2024-06-11', 1, 1, '2024-06-10 17:06:55', '2024-07-07 16:10:49', 0, 0),
(5, 1, '2024-07-16', 1, 1, '2024-07-07 15:36:38', '2024-07-07 16:10:54', 0, 0),
(6, 0, '2024-07-25', 1, 1, '2024-07-07 19:22:58', '2024-07-07 19:22:58', 0, 0);

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

--
-- Structure de la table `sous_categories`
--

CREATE TABLE `sous_categories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `nom` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `categorie_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;

--
-- Déchargement des données de la table `sous_categories`
--

INSERT INTO `sous_categories` (`id`, `nom`, `image`, `categorie_id`, `created_at`, `updated_at`) VALUES
(1, 'Maconneries', '1716227574.jpg', 1, '2024-05-20 17:52:54', '2024-05-20 17:56:24'),
(2, 'Plomberie', '1716491464.jpg', 1, '2024-05-23 19:11:04', '2024-05-23 19:11:04'),
(3, 'Plomberie', '1716491481.jpg', 1, '2024-05-23 19:11:21', '2024-05-23 19:11:21'),
(4, 'Plomberie', '1716491491.jpg', 1, '2024-05-23 19:11:31', '2024-05-23 19:11:31'),
(5, 'Plomberie', '1716491500.jpg', 1, '2024-05-23 19:11:40', '2024-05-23 19:11:40'),
(6, 'Plomberie', '1716491510.jpg', 1, '2024-05-23 19:11:50', '2024-05-23 19:11:50'),
(7, 'Plomberie', '1716491522.jpg', 1, '2024-05-23 19:12:02', '2024-05-23 19:12:02'),
(8, 'Plomberie', '1716491531.jpg', 1, '2024-05-23 19:12:11', '2024-05-23 19:12:11'),
(9, 'Plomberie', '1716491541.jpg', 1, '2024-05-23 19:12:21', '2024-05-23 19:12:21'),
(10, 'Plomberie', '1716491550.jpg', 1, '2024-05-23 19:12:30', '2024-05-23 19:12:30'),
(11, 'Plomberie', '1716491560.jpg', 1, '2024-05-23 19:12:40', '2024-05-23 19:12:40'),
(12, 'Plomberie', '1716491569.jpg', 1, '2024-05-23 19:12:49', '2024-05-23 19:12:49'),
(13, 'Plomberie', '1716491581.jpg', 1, '2024-05-23 19:13:01', '2024-05-23 19:13:01');

--
-- Index pour les tables déchargées
--

--
-- Index pour la table `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`id`);

--
-- Index pour la table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Index pour la table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Index pour la table `notations`
--
ALTER TABLE `notations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `notations_reservation_id_foreign` (`reservation_id`);

--
-- Index pour la table `reservations`
--
ALTER TABLE `reservations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `reservations_client_id_foreign` (`client_id`),
  ADD KEY `reservations_ouvrier_id_foreign` (`ouvrier_id`);

--
-- Index pour la table `sous_categories`
--
ALTER TABLE `sous_categories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sous_categories_categorie_id_foreign` (`categorie_id`);

--
-- AUTO_INCREMENT pour les tables déchargées
--

--
-- AUTO_INCREMENT pour la table `categories`
--
ALTER TABLE `categories`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

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

--
-- AUTO_INCREMENT pour la table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT pour la table `notations`
--
ALTER TABLE `notations`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT pour la table `reservations`
--
ALTER TABLE `reservations`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT pour la table `sous_categories`
--
ALTER TABLE `sous_categories`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- Contraintes pour les tables déchargées
--

--
-- Contraintes pour la table `notations`
--
ALTER TABLE `notations`
  ADD CONSTRAINT `notations_reservation_id_foreign` FOREIGN KEY (`reservation_id`) REFERENCES `reservations` (`id`);

--
-- Contraintes pour la table `reservations`
--
ALTER TABLE `reservations`
  ADD CONSTRAINT `reservations_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`),
  ADD CONSTRAINT `reservations_ouvrier_id_foreign` FOREIGN KEY (`ouvrier_id`) REFERENCES `ouvriers` (`id`);

--
-- Contraintes pour la table `sous_categories`
--
ALTER TABLE `sous_categories`
  ADD CONSTRAINT `sous_categories_categorie_id_foreign` FOREIGN KEY (`categorie_id`) REFERENCES `categories` (`id`);
COMMIT;

