-- 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 zhossan
-- -----------------------------------------------------

CREATE SCHEMA IF NOT EXISTS `zhossan` DEFAULT CHARACTER SET utf8 ;
USE `zhossan` ;

-- -----------------------------------------------------
-- Table `zhossan`.`Sessie`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `zhossan`.`Sessie` (
  `UserID` INT NOT NULL AUTO_INCREMENT,
  `Naam` CHAR(3) NULL,
  `Score` INT(5) NULL,
  `Datum` DATETIME NULL,
  PRIMARY KEY (`UserID`))
ENGINE = InnoDB;

-- -----------------------------------------------------
-- Table `zhossan`.`Achievements`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `zhossan`.`Achievements` (
  `AchievementID` INT NOT NULL AUTO_INCREMENT,
  `Achievement` VARCHAR(45) NULL,
  PRIMARY KEY (`AchievementID`))
ENGINE = InnoDB;

-- -----------------------------------------------------
-- Table `zhossan`.`Sessie_has_Achievements`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `zhossan`.`Sessie_has_Achievements` (
  `Sessie_UserID` INT NOT NULL,
  `Achievements_AchievementID` INT NOT NULL,
  PRIMARY KEY (`Sessie_UserID`, `Achievements_AchievementID`),
  INDEX `fk_Sessie_has_Achievements_Achievements1_idx` (`Achievements_AchievementID` ASC) VISIBLE,
  INDEX `fk_Sessie_has_Achievements_Sessie_idx` (`Sessie_UserID` ASC) VISIBLE,
  CONSTRAINT `fk_Sessie_has_Achievements_Sessie`
    FOREIGN KEY (`Sessie_UserID`)
    REFERENCES `zhossan`.`Sessie` (`UserID`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_Sessie_has_Achievements_Achievements1`
    FOREIGN KEY (`Achievements_AchievementID`)
    REFERENCES `zhossan`.`Achievements` (`AchievementID`)
    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;