text: -- MySQL Script generated by MySQL Workbench
  -- Thu Feb  6 14:14:10 2020
  -- 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 mydb
  -- -----------------------------------------------------
  
  -- -----------------------------------------------------
  -- Schema mydb
  -- -----------------------------------------------------
  CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 ;
  USE `mydb` ;
  
  -- -----------------------------------------------------
  -- Table `mydb`.`Empresa`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `mydb`.`Empresa` (
    `idEmpresa` INT NOT NULL,
    `nome` VARCHAR(255) NOT NULL,
    `cnpj` VARCHAR(255) NOT NULL,
    PRIMARY KEY (`idEmpresa`))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `mydb`.`Users`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `mydb`.`Users` (
    `idUsers` INT NOT NULL AUTO_INCREMENT,
    `nome` VARCHAR(255) NOT NULL,
    `email` VARCHAR(255) NOT NULL,
    `senha` VARCHAR(255) NOT NULL,
    `cpf` INT NULL,
    `Empresa_idEmpresa` INT NOT NULL,
    PRIMARY KEY (`idUsers`),
    INDEX `fk_Users_Empresa1_idx` (`Empresa_idEmpresa` ASC) VISIBLE,
    CONSTRAINT `fk_Users_Empresa1`
      FOREIGN KEY (`Empresa_idEmpresa`)
      REFERENCES `mydb`.`Empresa` (`idEmpresa`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `mydb`.`Licenca`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `mydb`.`Licenca` (
    `idLicenca` INT NOT NULL AUTO_INCREMENT,
    `tipo` INT NOT NULL,
    `numero` INT NOT NULL,
    `empreendedor` VARCHAR(255) NOT NULL,
    `cnpj` VARCHAR(255) NOT NULL,
    `Users_idUsers` INT NOT NULL,
    PRIMARY KEY (`idLicenca`),
    INDEX `fk_Licenca_Users1_idx` (`Users_idUsers` ASC) VISIBLE,
    CONSTRAINT `fk_Licenca_Users1`
      FOREIGN KEY (`Users_idUsers`)
      REFERENCES `mydb`.`Users` (`idUsers`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `mydb`.`Draga`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `mydb`.`Draga` (
    `idDraga` INT NOT NULL AUTO_INCREMENT,
    `nome` VARCHAR(255) NOT NULL,
    `empreendedor` VARCHAR(255) NOT NULL,
    `Licenca_idLicenca` INT NOT NULL,
    PRIMARY KEY (`idDraga`),
    INDEX `fk_Draga_Licenca_idx` (`Licenca_idLicenca` ASC) VISIBLE,
    CONSTRAINT `fk_Draga_Licenca`
      FOREIGN KEY (`Licenca_idLicenca`)
      REFERENCES `mydb`.`Licenca` (`idLicenca`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `mydb`.`Area`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `mydb`.`Area` (
    `idArea` INT NOT NULL AUTO_INCREMENT,
    `nome` VARCHAR(255) NOT NULL,
    `mineradora` VARCHAR(255) NOT NULL,
    `Licenca_idLicenca` INT NOT NULL,
    PRIMARY KEY (`idArea`),
    INDEX `fk_Area_Licenca1_idx` (`Licenca_idLicenca` ASC) VISIBLE,
    CONSTRAINT `fk_Area_Licenca1`
      FOREIGN KEY (`Licenca_idLicenca`)
      REFERENCES `mydb`.`Licenca` (`idLicenca`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `mydb`.`Terminal`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `mydb`.`Terminal` (
    `idTerminal` INT NOT NULL,
    `nome` VARCHAR(255) NOT NULL,
    `empreendedor` VARCHAR(255) NOT NULL,
    `Licenca_idLicenca` INT NOT NULL,
    PRIMARY KEY (`idTerminal`),
    INDEX `fk_Terminal_Licenca1_idx` (`Licenca_idLicenca` ASC) VISIBLE,
    CONSTRAINT `fk_Terminal_Licenca1`
      FOREIGN KEY (`Licenca_idLicenca`)
      REFERENCES `mydb`.`Licenca` (`idLicenca`)
      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;
  