text: -- MySQL Script generated by MySQL Workbench
  -- sam. 31 oct. 2015 23:50:26 CET
  -- 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='ALLOW_INVALID_DATES';
  
  -- -----------------------------------------------------
  -- Schema WaTuGa_projet2
  -- -----------------------------------------------------
  DROP SCHEMA IF EXISTS `WaTuGa_projet2` ;
  
  -- -----------------------------------------------------
  -- Schema WaTuGa_projet2
  -- -----------------------------------------------------
  CREATE SCHEMA IF NOT EXISTS `WaTuGa_projet2` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
  USE `WaTuGa_projet2` ;
  
  -- -----------------------------------------------------
  -- Table `WaTuGa_projet2`.`User`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `WaTuGa_projet2`.`User` ;
  
  CREATE TABLE IF NOT EXISTS `WaTuGa_projet2`.`User` (
    `pseudo` VARCHAR(45) NOT NULL,
    `lastname` VARCHAR(45) NOT NULL,
    `firstname` VARCHAR(45) NOT NULL,
    `mail` VARCHAR(45) NOT NULL,
    PRIMARY KEY (`pseudo`))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `WaTuGa_projet2`.`Review`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `WaTuGa_projet2`.`Review` ;
  
  CREATE TABLE IF NOT EXISTS `WaTuGa_projet2`.`Review` (
    `creationDate` TIMESTAMP NOT NULL DEFAULT '2015-11-03 00:00:00',
    `editionDate` TIMESTAMP NOT NULL DEFAULT '2015-11-03 00:00:00',
    `title` VARCHAR(45) NOT NULL,
    `release` TIMESTAMP NOT NULL DEFAULT '2015-11-03 00:00:00',
    `producer` VARCHAR(45) NULL,
    `summary` VARCHAR(255) NULL,
    `kind` VARCHAR(45) NULL,
    `nationnality` VARCHAR(45) NULL,
    PRIMARY KEY (`title`))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `WaTuGa_projet2`.`Actor`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `WaTuGa_projet2`.`Actor` ;
  
  CREATE TABLE IF NOT EXISTS `WaTuGa_projet2`.`Actor` (
    `lastname` VARCHAR(45) NOT NULL,
    `firstname` VARCHAR(45) NOT NULL,
    PRIMARY KEY (`lastname`, `firstname`))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `WaTuGa_projet2`.`ActorReview`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `WaTuGa_projet2`.`ActorReview` ;
  
  CREATE TABLE IF NOT EXISTS `WaTuGa_projet2`.`ActorReview` (
    `review_title` VARCHAR(45) NOT NULL,
    `actor_lastname` VARCHAR(45) NOT NULL,
    `actor_firstname` VARCHAR(45) NOT NULL,
    PRIMARY KEY (`review_title`, `actor_lastname`, `actor_firstname`),
    CONSTRAINT `review_title_fk_ActorReview`
      FOREIGN KEY (`review_title`)
      REFERENCES `WaTuGa_projet2`.`Review` (`title`)
      ON DELETE CASCADE
      ON UPDATE CASCADE,
    CONSTRAINT `lastname_fk_ActorReview`
      FOREIGN KEY (`actor_lastname`)
      REFERENCES `WaTuGa_projet2`.`Actor` (`lastname`)
      ON DELETE CASCADE
      ON UPDATE CASCADE)
  --  CONSTRAINT `firstname_fk_ActorReview`
  --    FOREIGN KEY (`actor_firstname`)
  --    REFERENCES `WaTuGa_projet2`.`Actor` (`firstname`)
  --    ON DELETE CASCADE
  --    ON UPDATE CASCADE)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `WaTuGa_projet2`.`Comment`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `WaTuGa_projet2`.`Comment` ;
  
  CREATE TABLE IF NOT EXISTS `WaTuGa_projet2`.`Comment` (
    `review_title` VARCHAR(45) NOT NULL,
    `comment` VARCHAR(45) NOT NULL,
    `user_pseudo` VARCHAR(45) NOT NULL,
    PRIMARY KEY (`review_title`, `user_pseudo`),
    INDEX `user_pseudo_fk_Comment_idx` (`user_pseudo` ASC),
    CONSTRAINT `user_pseudo_fk_Comment`
      FOREIGN KEY (`user_pseudo`)
      REFERENCES `WaTuGa_projet2`.`User` (`pseudo`)
      ON DELETE CASCADE
      ON UPDATE CASCADE,
    CONSTRAINT `review_title_fk_Comment`
      FOREIGN KEY (`review_title`)
      REFERENCES `WaTuGa_projet2`.`Review` (`title`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `WaTuGa_projet2`.`Mark`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `WaTuGa_projet2`.`Mark` ;
  
  CREATE TABLE IF NOT EXISTS `WaTuGa_projet2`.`Mark` (
    `review_title` VARCHAR(45) NOT NULL,
    `mark` INT NOT NULL,
    `user_pseudo` VARCHAR(45) NOT NULL,
    PRIMARY KEY (`review_title`, `user_pseudo`),
    INDEX `user_pseudo_idx` (`user_pseudo` ASC),
    CONSTRAINT `user_pseudo_fk_Mark`
      FOREIGN KEY (`user_pseudo`)
      REFERENCES `WaTuGa_projet2`.`User` (`pseudo`)
      ON DELETE CASCADE
      ON UPDATE CASCADE,
    CONSTRAINT `review_title_fk_Mark`
      FOREIGN KEY (`review_title`)
      REFERENCES `WaTuGa_projet2`.`Review` (`title`)
      ON DELETE CASCADE
      ON UPDATE CASCADE)
  ENGINE = InnoDB;
  
  
  SET SQL_MODE=@OLD_SQL_MODE;
  SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
  SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
  
  -- -----------------------------------------------------
  -- Data for table `WaTuGa_projet2`.`User`
  -- -----------------------------------------------------
  START TRANSACTION;
  USE `WaTuGa_projet2`;
  INSERT INTO `WaTuGa_projet2`.`User` (`pseudo`, `lastname`, `firstname`, `mail`) VALUES ('pwarlot', 'Warlot', 'Pierre-Quentin', 'w.p.q@test.java');
  
  COMMIT;
  
  
  -- -----------------------------------------------------
  -- Data for table `WaTuGa_projet2`.`Review`
  -- -----------------------------------------------------
  START TRANSACTION;
  USE `WaTuGa_projet2`;
  INSERT INTO `WaTuGa_projet2`.`Review` (`creationDate`, `editionDate`, `title`, `release`, `producer`, `summary`, `kind`, `nationnality`) VALUES ('2015-11-03 00:00:00', '2015-11-03 00:00:00', 'test1', '2015-11-03 00:00:00', 'Arthuer', 'Aucun', 'Action', 'Francais');
  
  COMMIT;
  
  -- -----------------------------------------------------
  -- Data for table `WaTuGa_projet2`.`Actor`
  -- -----------------------------------------------------
  START TRANSACTION;
  USE `WaTuGa_projet2`;
  INSERT INTO `WaTuGa_projet2`.`Actor` (`lastname`, `firstname`) VALUES ('Tremblay', 'Guy');
  INSERT INTO `WaTuGa_projet2`.`Actor` (`lastname`, `firstname`) VALUES ('Guillemette', 'Francois');
  
  COMMIT;
  
  
  -- -----------------------------------------------------
  -- Data for table `WaTuGa_projet2`.`ActorReview`
  -- -----------------------------------------------------
  START TRANSACTION;
  USE `WaTuGa_projet2`;
  INSERT INTO `WaTuGa_projet2`.`ActorReview` (`review_title`, `actor_lastname`, `actor_firstname`) VALUES ('test1', 'Tremblay', 'Guy');
  
  COMMIT;
  
  
  -- -----------------------------------------------------
  -- Data for table `WaTuGa_projet2`.`Comment`
  -- -----------------------------------------------------
  START TRANSACTION;
  USE `WaTuGa_projet2`;
  INSERT INTO `WaTuGa_projet2`.`Comment` (`review_title`, `comment`, `user_pseudo`) VALUES ('test1', 'Commentaire de test.', 'pwarlot');
  
  COMMIT;
  
  
  -- -----------------------------------------------------
  -- Data for table `WaTuGa_projet2`.`Mark`
  -- -----------------------------------------------------
  START TRANSACTION;
  USE `WaTuGa_projet2`;
  INSERT INTO `WaTuGa_projet2`.`Mark` (`review_title`, `mark`, `user_pseudo`) VALUES ('test1', 5, 'pwarlot');
  
  COMMIT;
  
  