text: -- MySQL Script generated by MySQL Workbench
  -- Mon Mar  8 16:01:23 2021
  -- Model: New Model    Version: 1.0
  -- MySQL Workbench Forward Engineering
  
  SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
  SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
  SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
  
  -- -----------------------------------------------------
  -- Schema blog-p5
  -- -----------------------------------------------------
  
  -- -----------------------------------------------------
  -- Schema blog-p5
  -- -----------------------------------------------------
  CREATE SCHEMA IF NOT EXISTS `blog-p5` DEFAULT CHARACTER SET utf8 ;
  USE `blog-p5` ;
  
  -- -----------------------------------------------------
  -- Table `blog-p5`.`user`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `blog-p5`.`user` (
    `id_user` INT NOT NULL AUTO_INCREMENT,
    `firstName` VARCHAR(45) NULL,
    `lastName` VARCHAR(45) NULL,
    `email` VARCHAR(65) NULL,
    `password` VARCHAR(100) NULL,
    `pseudo` VARCHAR(45) NULL,
    `chapo` TINYTEXT NULL,
    `rank` VARCHAR(65) NULL,
    `rgpd` TINYINT NULL,
    `dateRgpd` DATETIME NULL,
    `token` VARCHAR(255) NULL,
    `dateTokenExpire` DATETIME NULL,
    `actif` TINYINT NULL,
    PRIMARY KEY (`id_user`),
    UNIQUE INDEX `email_UNIQUE` (`email` ASC),
    UNIQUE INDEX `pseudo_UNIQUE` (`pseudo` ASC))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `blog-p5`.`blogPost`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `blog-p5`.`blogPost` (
    `id_blogPost` INT NOT NULL AUTO_INCREMENT,
    `title` TINYTEXT NOT NULL,
    `chapo` TINYTEXT NULL,
    `content` LONGTEXT NULL,
    `dateCreate` DATETIME NOT NULL,
    `dateUpdate` DATETIME NULL,
    `publish` TINYINT NOT NULL,
    `actif` TINYINT NOT NULL,
    `id_author` INT NOT NULL,
    PRIMARY KEY (`id_blogPost`, `id_author`),
    INDEX `fk_blogPost_user_idx` (`id_author` ASC),
    CONSTRAINT `fk_blogPost_user`
      FOREIGN KEY (`id_author`)
      REFERENCES `blog-p5`.`user` (`id_user`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `blog-p5`.`comment`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `blog-p5`.`comment` (
    `idcomment` INT NOT NULL AUTO_INCREMENT,
    `content` LONGTEXT NULL,
    `date_create` DATETIME NOT NULL,
    `publish` TINYINT NOT NULL,
    `actif` TINYINT NOT NULL,
    `id_blogPost` INT NOT NULL,
    `id_author` INT NOT NULL,
    PRIMARY KEY (`idcomment`, `id_blogPost`, `id_author`),
    INDEX `fk_comment_blogPost1_idx` (`id_blogPost` ASC),
    INDEX `fk_comment_user1_idx` (`id_author` ASC),
    CONSTRAINT `fk_comment_blogPost1`
      FOREIGN KEY (`id_blogPost`)
      REFERENCES `blog-p5`.`blogPost` (`id_blogPost`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION,
    CONSTRAINT `fk_comment_user1`
      FOREIGN KEY (`id_author`)
      REFERENCES `blog-p5`.`user` (`id_user`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
  ENGINE = InnoDB;
  
  
  SET SQL_MODE=@OLD_SQL_MODE;
  SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
  SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
  