GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

SELECT VERSION();
-- Étape 1 : Création de la table User avec les champs FirstName, LastName, Email, Authorization, username et password
USE rakuten_db;
CREATE TABLE Users (
    FirstName VARCHAR(30),
    LastName VARCHAR(30),
    Email VARCHAR(30),
    Authorization INT,
    username VARCHAR(30),
    password VARCHAR(128) -- 128 caractères pour stocker le hachage bcrypt
);

-- Étape 2 : Insertion d'un utilisateur pour tester
INSERT INTO Users (FirstName, LastName, Email, Authorization, username, password) VALUES ('Olivier', 'Renouard', 'olivier.renouard1103@gmail.com', 2, 'Olivier', '$2b$12$FWFmGn05f245f637.i9uYOdVEcDD2sC7ZO0cC0ePOjtY/OB6pOp0q');
INSERT INTO Users (FirstName, LastName, Email, Authorization, username, password) VALUES ('Fadimatou', 'Abdoulaye', 'afadimatou@gmail.com', 2, 'Fadimatou' , '$2b$12$66yNO9XAmZj2vMbYu.icRueNRVJK/cTWvoSE3czHt/P5BlKSFBdyu');
INSERT INTO Users (FirstName, LastName, Email, Authorization, username, password) VALUES ('John', 'Doe', 'john.doe@example.com', 1, 'John', '$2b$12$pfyjoh3RWS9crj8lFwF3ROWeSZ26Eu5m1WknmMJ0RqCYp.AHiu.MO');
INSERT INTO Users (FirstName, LastName, Email, Authorization, username, password) VALUES ('Alice', 'Sapritch', 'alice.sapritch@example.com', 0, 'Alice', '$2b$12$vxWf8VtgaKDrCJmSkY/XUuwm7Fkqqu6W6BLvtfpymVAoR4mq7xrKq');

-- Étape 3 : Sélectionner et afficher le contenu de la table
SELECT * FROM Users;

SELECT 
    @@hostname AS 'HOST_NAME',
    @@port AS 'PORT';


