text: -- MySQL Script generated by MySQL Workbench
  -- Thu Jul 29 15:37:09 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 IT_Company_ArielL
  -- -----------------------------------------------------
  DROP SCHEMA IF EXISTS `IT_Company_ArielL` ;
  
  -- -----------------------------------------------------
  -- Schema IT_Company_ArielL
  -- -----------------------------------------------------
  CREATE SCHEMA IF NOT EXISTS `IT_Company_ArielL` DEFAULT CHARACTER SET utf8 ;
  USE `IT_Company_ArielL` ;
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Products`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Products` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Products` (
    `idProduct` INT NOT NULL AUTO_INCREMENT,
    `Prod_name` VARCHAR(45) NOT NULL,
    PRIMARY KEY (`idProduct`),
    UNIQUE INDEX `idProducts_UNIQUE` (`idProduct` ASC) VISIBLE)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Users`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Users` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Users` (
    `idUser` INT NOT NULL AUTO_INCREMENT,
    `UserName` VARCHAR(45) NOT NULL,
    `Password` VARCHAR(45) NOT NULL,
    PRIMARY KEY (`idUser`),
    UNIQUE INDEX `idUsers_UNIQUE` (`idUser` ASC) VISIBLE)
  ENGINE = InnoDB
  COMMENT = '			';
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Countries`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Countries` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Countries` (
    `idCountry` INT NOT NULL AUTO_INCREMENT,
    `Country_name` VARCHAR(45) NOT NULL,
    `AreaCode` INT NULL,
    PRIMARY KEY (`idCountry`),
    UNIQUE INDEX `idCountries_UNIQUE` (`idCountry` ASC) VISIBLE)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Cities`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Cities` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Cities` (
    `idCity` INT NOT NULL AUTO_INCREMENT,
    `City_name` VARCHAR(45) NOT NULL,
    `ZipCode` DOUBLE NOT NULL,
    `Country` INT NOT NULL,
    PRIMARY KEY (`idCity`),
    UNIQUE INDEX `idCities_UNIQUE` (`idCity` ASC) VISIBLE,
    INDEX `fk_Cities_Countries1_idx` (`Country` ASC) VISIBLE,
    CONSTRAINT `fk_Cities_Countries1`
      FOREIGN KEY (`Country`)
      REFERENCES `IT_Company_ArielL`.`Countries` (`idCountry`)
      ON DELETE RESTRICT
      ON UPDATE CASCADE)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Addresses`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Addresses` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Addresses` (
    `idAddress` INT NOT NULL AUTO_INCREMENT,
    `Street` VARCHAR(45) NOT NULL,
    `Number` INT NOT NULL,
    `City` INT NOT NULL,
    PRIMARY KEY (`idAddress`),
    UNIQUE INDEX `idAddresses_UNIQUE` (`idAddress` ASC) VISIBLE,
    INDEX `fk_Addresses_Cities1_idx` (`City` ASC) VISIBLE,
    CONSTRAINT `fk_Addresses_Cities1`
      FOREIGN KEY (`City`)
      REFERENCES `IT_Company_ArielL`.`Cities` (`idCity`)
      ON DELETE RESTRICT
      ON UPDATE CASCADE)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Employees`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Employees` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Employees` (
    `idEmployee` INT NOT NULL AUTO_INCREMENT,
    `Emp_name` VARCHAR(45) NOT NULL,
    `LastName` VARCHAR(45) NOT NULL,
    `BirthDate` DATE NOT NULL,
    `HireDate` DATE NOT NULL,
    `Phone` VARCHAR(45) NULL,
    `Email` VARCHAR(45) NOT NULL,
    `User` INT NOT NULL,
    `Addres` INT NOT NULL,
    `ReportsTo` INT NULL,
    PRIMARY KEY (`idEmployee`),
    UNIQUE INDEX `idEmployees_UNIQUE` (`idEmployee` ASC) VISIBLE,
    INDEX `fk_Employees_Users1_idx` (`User` ASC) VISIBLE,
    INDEX `fk_Employees_Addresses1_idx` (`Addres` ASC) VISIBLE,
    INDEX `fk_Employees_Employees1_idx` (`ReportsTo` ASC) VISIBLE,
    CONSTRAINT `fk_Employees_Users1`
      FOREIGN KEY (`User`)
      REFERENCES `IT_Company_ArielL`.`Users` (`idUser`)
      ON DELETE RESTRICT
      ON UPDATE CASCADE,
    CONSTRAINT `fk_Employees_Addresses1`
      FOREIGN KEY (`Addres`)
      REFERENCES `IT_Company_ArielL`.`Addresses` (`idAddress`)
      ON DELETE RESTRICT
      ON UPDATE CASCADE,
    CONSTRAINT `fk_Employees_Employees1`
      FOREIGN KEY (`ReportsTo`)
      REFERENCES `IT_Company_ArielL`.`Employees` (`idEmployee`)
      ON DELETE RESTRICT
      ON UPDATE CASCADE)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Versions`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Versions` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Versions` (
    `idVersion` INT NOT NULL AUTO_INCREMENT,
    `ReleaseDate` DATE NOT NULL,
    `Description` VARCHAR(45) NULL,
    `Product` INT NOT NULL,
    PRIMARY KEY (`idVersion`),
    UNIQUE INDEX `idVersion_UNIQUE` (`idVersion` ASC) VISIBLE,
    INDEX `fk_Versions_Products1_idx` (`Product` ASC) VISIBLE,
    CONSTRAINT `fk_Versions_Products1`
      FOREIGN KEY (`Product`)
      REFERENCES `IT_Company_ArielL`.`Products` (`idProduct`)
      ON DELETE CASCADE
      ON UPDATE CASCADE)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Areas`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Areas` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Areas` (
    `idArea` INT NOT NULL AUTO_INCREMENT,
    `Area_name` VARCHAR(45) NOT NULL,
    `Description` VARCHAR(45) NULL,
    PRIMARY KEY (`idArea`),
    UNIQUE INDEX `idAreas_UNIQUE` (`idArea` ASC) VISIBLE)
  ENGINE = InnoDB
  COMMENT = '	';
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Categories`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Categories` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Categories` (
    `idCategory` INT NOT NULL AUTO_INCREMENT,
    `Cat_name` VARCHAR(45) NOT NULL,
    `Description` VARCHAR(45) NULL,
    PRIMARY KEY (`idCategory`),
    UNIQUE INDEX `idCategories_UNIQUE` (`idCategory` ASC) VISIBLE)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Roles`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Roles` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Roles` (
    `idRole` INT NOT NULL AUTO_INCREMENT,
    `R_name` VARCHAR(45) NOT NULL,
    `Description` VARCHAR(45) NULL,
    PRIMARY KEY (`idRole`),
    UNIQUE INDEX `idRoles_UNIQUE` (`idRole` ASC) VISIBLE)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Costumers`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Costumers` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Costumers` (
    `idCostumer` INT NOT NULL AUTO_INCREMENT,
    `Ctm_name` VARCHAR(45) NOT NULL,
    `Email` VARCHAR(45) NOT NULL,
    `Phone` DOUBLE NULL,
    `Address` INT NOT NULL,
    PRIMARY KEY (`idCostumer`),
    UNIQUE INDEX `idCostumers_UNIQUE` (`idCostumer` ASC) VISIBLE,
    INDEX `fk_Costumers_Addresses1_idx` (`Address` ASC) VISIBLE,
    CONSTRAINT `fk_Costumers_Addresses1`
      FOREIGN KEY (`Address`)
      REFERENCES `IT_Company_ArielL`.`Addresses` (`idAddress`)
      ON DELETE RESTRICT
      ON UPDATE CASCADE)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Company`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Company` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Company` (
    `idCompany` INT NOT NULL AUTO_INCREMENT,
    `Com_name` VARCHAR(45) NOT NULL,
    `UBK` DOUBLE NOT NULL,
    `WebPage` DOUBLE NULL,
    `Email` VARCHAR(45) NOT NULL,
    `Address` INT NOT NULL,
    PRIMARY KEY (`idCompany`),
    UNIQUE INDEX `idCompany_UNIQUE` (`idCompany` ASC) VISIBLE,
    INDEX `fk_Company_Addresses2_idx` (`Address` ASC) VISIBLE,
    CONSTRAINT `fk_Company_Addresses2`
      FOREIGN KEY (`Address`)
      REFERENCES `IT_Company_ArielL`.`Addresses` (`idAddress`)
      ON DELETE RESTRICT
      ON UPDATE CASCADE)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Employees_Products`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Employees_Products` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Employees_Products` (
    `Employee` INT NOT NULL,
    `Product` INT NOT NULL,
    `idEmployeeProduct` INT NOT NULL AUTO_INCREMENT,
    INDEX `fk_Employees_has_Products_Products1_idx` (`Product` ASC) VISIBLE,
    INDEX `fk_Employees_has_Products_Employees_idx` (`Employee` ASC) VISIBLE,
    PRIMARY KEY (`idEmployeeProduct`),
    UNIQUE INDEX `Employees_Productscol_UNIQUE` (`idEmployeeProduct` ASC) VISIBLE,
    CONSTRAINT `fk_Employees_has_Products_Employees`
      FOREIGN KEY (`Employee`)
      REFERENCES `IT_Company_ArielL`.`Employees` (`idEmployee`)
      ON DELETE CASCADE
      ON UPDATE CASCADE,
    CONSTRAINT `fk_Employees_has_Products_Products1`
      FOREIGN KEY (`Product`)
      REFERENCES `IT_Company_ArielL`.`Products` (`idProduct`)
      ON DELETE CASCADE
      ON UPDATE CASCADE)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Products_Areas`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Products_Areas` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Products_Areas` (
    `Product` INT NOT NULL,
    `Area` INT NOT NULL,
    `idProductArea` INT NOT NULL AUTO_INCREMENT,
    INDEX `fk_Products_has_Areas_Areas1_idx` (`Area` ASC) VISIBLE,
    INDEX `fk_Products_has_Areas_Products1_idx` (`Product` ASC) VISIBLE,
    PRIMARY KEY (`idProductArea`),
    UNIQUE INDEX `idProductArea_UNIQUE` (`idProductArea` ASC) VISIBLE,
    CONSTRAINT `fk_Products_has_Areas_Products1`
      FOREIGN KEY (`Product`)
      REFERENCES `IT_Company_ArielL`.`Products` (`idProduct`)
      ON DELETE CASCADE
      ON UPDATE CASCADE,
    CONSTRAINT `fk_Products_has_Areas_Areas1`
      FOREIGN KEY (`Area`)
      REFERENCES `IT_Company_ArielL`.`Areas` (`idArea`)
      ON DELETE CASCADE
      ON UPDATE CASCADE)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Products_Categories`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Products_Categories` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Products_Categories` (
    `Product` INT NOT NULL,
    `Category` INT NOT NULL,
    `idProductCategory` INT NOT NULL AUTO_INCREMENT,
    INDEX `fk_Products_has_Categories_Categories1_idx` (`Category` ASC) VISIBLE,
    INDEX `fk_Products_has_Categories_Products1_idx` (`Product` ASC) VISIBLE,
    PRIMARY KEY (`idProductCategory`),
    UNIQUE INDEX `idProductCategory_UNIQUE` (`idProductCategory` ASC) VISIBLE,
    CONSTRAINT `fk_Products_has_Categories_Products1`
      FOREIGN KEY (`Product`)
      REFERENCES `IT_Company_ArielL`.`Products` (`idProduct`)
      ON DELETE CASCADE
      ON UPDATE CASCADE,
    CONSTRAINT `fk_Products_has_Categories_Categories1`
      FOREIGN KEY (`Category`)
      REFERENCES `IT_Company_ArielL`.`Categories` (`idCategory`)
      ON DELETE CASCADE
      ON UPDATE CASCADE)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Employees_Roles`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Employees_Roles` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Employees_Roles` (
    `Employee` INT NOT NULL,
    `Role` INT NOT NULL,
    `idEmployeeRole` INT NOT NULL AUTO_INCREMENT,
    INDEX `fk_Employees_has_Roles_Roles1_idx` (`Role` ASC) VISIBLE,
    INDEX `fk_Employees_has_Roles_Employees1_idx` (`Employee` ASC) VISIBLE,
    PRIMARY KEY (`idEmployeeRole`),
    UNIQUE INDEX `idEmployeeRole_UNIQUE` (`idEmployeeRole` ASC) VISIBLE,
    CONSTRAINT `fk_Employees_has_Roles_Employees1`
      FOREIGN KEY (`Employee`)
      REFERENCES `IT_Company_ArielL`.`Employees` (`idEmployee`)
      ON DELETE CASCADE
      ON UPDATE CASCADE,
    CONSTRAINT `fk_Employees_has_Roles_Roles1`
      FOREIGN KEY (`Role`)
      REFERENCES `IT_Company_ArielL`.`Roles` (`idRole`)
      ON DELETE CASCADE
      ON UPDATE CASCADE)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `IT_Company_ArielL`.`Salaries`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `IT_Company_ArielL`.`Salaries` ;
  
  CREATE TABLE IF NOT EXISTS `IT_Company_ArielL`.`Salaries` (
    `idSalary` INT NOT NULL AUTO_INCREMENT,
    `Amount` DOUBLE NOT NULL,
    `PayDay` DATE NOT NULL,
    `Employee` INT NOT NULL,
    PRIMARY KEY (`idSalary`),
    UNIQUE INDEX `idSalaries_UNIQUE` (`idSalary` ASC) VISIBLE,
    INDEX `fk_Salaries_Employees1_idx` (`Employee` ASC) VISIBLE,
    CONSTRAINT `fk_Salaries_Employees1`
      FOREIGN KEY (`Employee`)
      REFERENCES `IT_Company_ArielL`.`Employees` (`idEmployee`)
      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;
  