-- phpMyAdmin SQL Dump
-- version 5.2.2
-- https://www.phpmyadmin.net/
--
-- Hôte : localhost:3306
-- Généré le : dim. 09 nov. 2025 à 23:43
-- Version du serveur : 11.4.9-MariaDB
-- Version de PHP : 8.3.27

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

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

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

--
-- Structure de la table `login_attempts`
--

CREATE TABLE `login_attempts` (
  `id` int(11) NOT NULL,
  `email` varchar(190) NOT NULL,
  `ip` varchar(64) NOT NULL,
  `attempts` int(11) NOT NULL DEFAULT 0,
  `last_attempt` datetime DEFAULT NULL,
  `lock_until` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure de la table `password_resets`
--

CREATE TABLE `password_resets` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `token_hash` char(64) NOT NULL,
  `expires_at` datetime NOT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `password_resets` (`id`, `user_id`, `token_hash`, `expires_at`, `created_at`) VALUES
(4, 5, '4b8f0651cb5caf2a5f1ad894f9ce4800ed7662b1b8184938f05a89e2b42e490f', '2025-10-14 13:51:20', '2025-10-14 14:51:20');

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

--
-- Structure de la table `uploads`
--

CREATE TABLE `uploads` (
  `id` bigint(20) NOT NULL,
  `user_id` int(11) NOT NULL,
  `original_name` varchar(255) NOT NULL,
  `stored_name` varchar(255) NOT NULL,
  `mime_type` varchar(150) NOT NULL,
  `size_bytes` bigint(20) NOT NULL,
  `sha256` char(64) NOT NULL,
  `uploaded_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `uploader_ip` varchar(45) DEFAULT NULL,
  `user_agent` varchar(255) DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `filename` varchar(255) DEFAULT NULL,
  `period_start` date DEFAULT NULL,
  `period_end` date DEFAULT NULL,
  `eple` varchar(128) DEFAULT NULL,
  `action_label` varchar(128) DEFAULT NULL,
  `ref_session` varchar(64) DEFAULT NULL,
  `formation` varchar(128) DEFAULT NULL,
  `nb_apprenants` int(11) DEFAULT NULL,
  `discipline` varchar(128) DEFAULT NULL,
  `proof_type` enum('doc','pdf','image','tableur','audio','video','autre') DEFAULT NULL,
  `status` enum('en_attente','validee','rejetee') NOT NULL DEFAULT 'en_attente',
  `status_note` varchar(255) DEFAULT NULL,
  `ip_address` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `uploads` (`id`, `user_id`, `original_name`, `stored_name`, `mime_type`, `size_bytes`, `sha256`, `uploaded_at`, `uploader_ip`, `user_agent`, `created_at`, `filename`, `period_start`, `period_end`, `eple`, `action_label`, `ref_session`, `formation`, `nb_apprenants`, `discipline`, `proof_type`, `status`, `status_note`, `ip_address`) VALUES
(11, 8, '05.11.2025_12.47.00_REC.png', 'f39247b193d43d2bb7432daab1b45410.png', 'image/png', 71500, 'd2d2d930d5478652233298c817173256e29439cb812302cfaa59313a385b8baa', '2025-11-05 14:27:12', '188.231.23.28', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36', '2025-11-05 15:27:12', 'f39247b193d43d2bb7432daab1b45410.png', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'validee', NULL, NULL),
(13, 9, 'logogretalm.png', '423262563d1d797bb3c27cefdb050654.png', 'image/png', 82575, 'a133d44b958efabde1d141b89dd293f2b3d4f74751d2af98d28d91918296d746', '2025-11-09 15:07:39', '92.159.34.137', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36', '2025-11-09 16:07:39', '423262563d1d797bb3c27cefdb050654.png', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'validee', NULL, NULL),
(19, 9, 'FOAD.docx', '82317cbff01f821520db75567b37cab5.docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 15619, 'a33a9a4eaf1030eb31ceeee9e924a530a8ba5daf8789fd830344856bf0c1c376', '2025-11-09 18:00:21', '92.159.34.137', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36', '2025-11-09 19:00:21', '82317cbff01f821520db75567b37cab5.docx', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'validee', NULL, NULL),
(20, 10, 'uploads_20251108_212631.xlsx', '20251109_tsavea_rumas_isabelle.xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 6480, '7f8122204e43f697627b6b3204146f5017e25e1d4bbf79290aa06fed5fa7957e', '2025-11-09 20:41:33', '92.159.34.137', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36', '2025-11-09 21:41:33', '20251109_tsavea_rumas_isabelle.xlsx', '2025-10-27', '2026-01-30', 'Colbert', 'TSAVEA', 'tsavea', 'tsavea', 12, 'test2', 'tableur', 'validee', NULL, '92.159.34.137');

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

--
-- Structure de la table `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `email` varchar(190) NOT NULL,
  `password_hash` varchar(255) NOT NULL,
  `first_name` varchar(100) NOT NULL,
  `last_name` varchar(100) NOT NULL,
  `role` enum('admin','trainer') NOT NULL DEFAULT 'trainer',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `reset_token` varchar(64) DEFAULT NULL,
  `reset_expires` datetime DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `users` (`id`, `email`, `password_hash`, `first_name`, `last_name`, `role`, `created_at`, `reset_token`, `reset_expires`, `password`) VALUES
(5, 'delphine.vauchel@ac-lille.fr', '$2y$10$9vMGmv7w0AJf4qrLUg6JoO/ehs2QOexnmrVfURta/IxBb1HQUauUi', 'Delphine', 'Vauchel', 'admin', '2025-10-02 15:06:49', NULL, NULL, NULL),
(6, 'louise.batista@ac-lille.fr', '$2y$10$MeCCl8d5XJmj1QNmZApXUONt6Y.De3/4MDLre4XvaHHIhdg6USno6', 'Louise', 'Batista', 'admin', '2025-10-02 15:40:21', NULL, NULL, NULL),
(8, 'vincent.genin@ac-lille.fr', '$2y$10$qmT7v5yqfBL9n15HB7.wku0bNC1eOMgvVoUIFVyg8i9C0DBkJTPk2', 'Vincent', 'Génin', 'trainer', '2025-11-05 14:25:07', NULL, NULL, NULL),
(9, 'jacques.favorel@ac-lille.fr', '$2y$10$9CnGlKaAcXUssyW6cjueEe84Q/2n8PhyhnGSpokCyLFG0HkiDtkLu', 'Jacques', 'Favorel', 'admin', '2025-11-09 14:44:20', NULL, NULL, '$2y$10$yxSTigBsxoCCIrEwj3t5CuzfJyog9Xren29fq1.ycZmpkB2Va63oi'),
(10, 'jfavorel@gmail.com', '$2y$10$6vAvLv/j.nRQW/FzlYfnseZWMHynCeMaPtYjddF5AYAP4CokVpdbC', 'Isabelle', 'Rumas', 'trainer', '2025-11-09 19:19:32', NULL, NULL, NULL);

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

--
-- Index pour la table `login_attempts`
--
ALTER TABLE `login_attempts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `email` (`email`),
  ADD KEY `ip` (`ip`);

--
-- Index pour la table `password_resets`
--
ALTER TABLE `password_resets`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uniq_token` (`token_hash`),
  ADD KEY `ix_user_id` (`user_id`);

--
-- Index pour la table `uploads`
--
ALTER TABLE `uploads`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`,`uploaded_at`);

--
-- Index pour la table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `email` (`email`),
  ADD UNIQUE KEY `uniq_users_email` (`email`),
  ADD KEY `idx_users_reset_token` (`reset_token`);

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

--
-- AUTO_INCREMENT pour la table `login_attempts`
--
ALTER TABLE `login_attempts`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT pour la table `password_resets`
--
ALTER TABLE `password_resets`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT pour la table `uploads`
--
ALTER TABLE `uploads`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;

--
-- AUTO_INCREMENT pour la table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

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

--
-- Contraintes pour la table `password_resets`
--
ALTER TABLE `password_resets`
  ADD CONSTRAINT `fk_pwreset_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `uploads`
--
ALTER TABLE `uploads`
  ADD CONSTRAINT `uploads_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
