-- MySQL Script generated by MySQL Workbench
-- Mon May 12 19:39:50 2025
-- 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 pozorisp3_Semenyakin
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `pozorisp3_Semenyakin` ;

-- -----------------------------------------------------
-- Schema pozorisp3_Semenyakin
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `pozorisp3_Semenyakin` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci ;
USE `pozorisp3_Semenyakin` ;

-- -----------------------------------------------------
-- Table `pozorisp3_Semenyakin`.`Job title`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `pozorisp3_Semenyakin`.`Job title` ;

CREATE TABLE IF NOT EXISTS `pozorisp3_Semenyakin`.`Job title` (
  `idjob title` INT NOT NULL,
  `job title` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`idjob title`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;


-- -----------------------------------------------------
-- Table `pozorisp3_Semenyakin`.`Medical certificate`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `pozorisp3_Semenyakin`.`Medical certificate` ;

CREATE TABLE IF NOT EXISTS `pozorisp3_Semenyakin`.`Medical certificate` (
  `idMedical certificate` INT NOT NULL,
  `reference` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`idMedical certificate`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;


-- -----------------------------------------------------
-- Table `pozorisp3_Semenyakin`.`Permission to work with equipment`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `pozorisp3_Semenyakin`.`Permission to work with equipment` ;

CREATE TABLE IF NOT EXISTS `pozorisp3_Semenyakin`.`Permission to work with equipment` (
  `idPermission to work with equipment` INT NOT NULL,
  `permission` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`idPermission to work with equipment`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;


-- -----------------------------------------------------
-- Table `pozorisp3_Semenyakin`.`Quests`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `pozorisp3_Semenyakin`.`Quests` ;

CREATE TABLE IF NOT EXISTS `pozorisp3_Semenyakin`.`Quests` (
  `idQuests` INT NOT NULL AUTO_INCREMENT,
  `Quest` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`idQuests`))
ENGINE = InnoDB
AUTO_INCREMENT = 6
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;


-- -----------------------------------------------------
-- Table `pozorisp3_Semenyakin`.`Managers and emplioyees`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `pozorisp3_Semenyakin`.`Managers and emplioyees` ;

CREATE TABLE IF NOT EXISTS `pozorisp3_Semenyakin`.`Managers and emplioyees` (
  `idManagers and emplioyees2` INT NOT NULL,
  `Full name` VARCHAR(45) NOT NULL,
  `Job title` INT NOT NULL,
  `Search for partners` VARCHAR(45) NOT NULL,
  `Rating of changes` VARCHAR(45) NOT NULL,
  `Applications` VARCHAR(45) NOT NULL,
  `Date of birth` VARCHAR(45) NOT NULL,
  `Experience` VARCHAR(45) NOT NULL,
  `Medical certificate` INT NOT NULL,
  `Permission to work with equipment` INT NOT NULL,
  `Quests` INT NOT NULL,
  PRIMARY KEY (`idManagers and emplioyees2`),
  INDEX `Managers_idx` (`Job title` ASC) VISIBLE,
  INDEX `Medical_idx` (`Medical certificate` ASC) VISIBLE,
  INDEX `Quests_idx` (`Quests` ASC) VISIBLE,
  INDEX `Permission to work with equipment_idx` (`Permission to work with equipment` ASC) VISIBLE,
  CONSTRAINT `Job title`
    FOREIGN KEY (`Job title`)
    REFERENCES `pozorisp3_Semenyakin`.`Job title` (`idjob title`),
  CONSTRAINT `Medical certificate`
    FOREIGN KEY (`Medical certificate`)
    REFERENCES `pozorisp3_Semenyakin`.`Medical certificate` (`idMedical certificate`),
  CONSTRAINT `Permission to work with equipment`
    FOREIGN KEY (`Permission to work with equipment`)
    REFERENCES `pozorisp3_Semenyakin`.`Permission to work with equipment` (`idPermission to work with equipment`),
  CONSTRAINT `Quests`
    FOREIGN KEY (`Quests`)
    REFERENCES `pozorisp3_Semenyakin`.`Quests` (`idQuests`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;


-- -----------------------------------------------------
-- Table `pozorisp3_Semenyakin`.`Partners and suppliers`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `pozorisp3_Semenyakin`.`Partners and suppliers` ;

CREATE TABLE IF NOT EXISTS `pozorisp3_Semenyakin`.`Partners and suppliers` (
  `idPartners and suppliers` INT NOT NULL AUTO_INCREMENT,
  `Type` VARCHAR(45) NOT NULL,
  `Company name` VARCHAR(45) NOT NULL,
  `TIN` VARCHAR(45) NOT NULL,
  `Telephone` VARCHAR(45) NOT NULL,
  `Email` VARCHAR(45) NOT NULL,
  `Rating` VARCHAR(45) NOT NULL,
  `Order history` VARCHAR(45) NOT NULL,
  `Delivery history` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`idPartners and suppliers`))
ENGINE = InnoDB
AUTO_INCREMENT = 5
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;


-- -----------------------------------------------------
-- Table `pozorisp3_Semenyakin`.`Status`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `pozorisp3_Semenyakin`.`Status` ;

CREATE TABLE IF NOT EXISTS `pozorisp3_Semenyakin`.`Status` (
  `idStatus` INT NOT NULL AUTO_INCREMENT,
  `Status` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`idStatus`))
ENGINE = InnoDB
AUTO_INCREMENT = 3
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;


-- -----------------------------------------------------
-- Table `pozorisp3_Semenyakin`.`The proposal has been formed`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `pozorisp3_Semenyakin`.`The proposal has been formed` ;

CREATE TABLE IF NOT EXISTS `pozorisp3_Semenyakin`.`The proposal has been formed` (
  `idThe proposal has been formed` INT NOT NULL AUTO_INCREMENT,
  `The proposal has been formed` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`idThe proposal has been formed`))
ENGINE = InnoDB
AUTO_INCREMENT = 3
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;


-- -----------------------------------------------------
-- Table `pozorisp3_Semenyakin`.`Requests_and_access`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `pozorisp3_Semenyakin`.`Requests_and_access` ;

CREATE TABLE IF NOT EXISTS `pozorisp3_Semenyakin`.`Requests_and_access` (
  `idRequests_and_access` INT NOT NULL,
  `client` VARCHAR(45) NOT NULL,
  `order history` VARCHAR(45) NOT NULL,
  `The proposal has been formed` INT NOT NULL,
  `Price` VARCHAR(45) NOT NULL,
  `Deadlines` VARCHAR(45) NOT NULL,
  `status` INT NOT NULL,
  `Entry time` VARCHAR(45) NOT NULL,
  `Release time` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`idRequests_and_access`),
  INDEX `The proposal has been formed_idx` (`The proposal has been formed` ASC) VISIBLE,
  INDEX `Status_idx` (`status` ASC) VISIBLE,
  CONSTRAINT `Status`
    FOREIGN KEY (`status`)
    REFERENCES `pozorisp3_Semenyakin`.`Status` (`idStatus`),
  CONSTRAINT `The proposal has been formed`
    FOREIGN KEY (`The proposal has been formed`)
    REFERENCES `pozorisp3_Semenyakin`.`The proposal has been formed` (`idThe proposal has been formed`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;


-- -----------------------------------------------------
-- Table `pozorisp3_Semenyakin`.`Supplier`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `pozorisp3_Semenyakin`.`Supplier` ;

CREATE TABLE IF NOT EXISTS `pozorisp3_Semenyakin`.`Supplier` (
  `idSupplier` INT NOT NULL,
  `Shop` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`idSupplier`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;


-- -----------------------------------------------------
-- Table `pozorisp3_Semenyakin`.`Type`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `pozorisp3_Semenyakin`.`Type` ;

CREATE TABLE IF NOT EXISTS `pozorisp3_Semenyakin`.`Type` (
  `idType` INT NOT NULL,
  `тип` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`idType`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;


-- -----------------------------------------------------
-- Table `pozorisp3_Semenyakin`.`Unit of measurement`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `pozorisp3_Semenyakin`.`Unit of measurement` ;

CREATE TABLE IF NOT EXISTS `pozorisp3_Semenyakin`.`Unit of measurement` (
  `idUnit of measurement` INT NOT NULL AUTO_INCREMENT,
  `Unit of measurement` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`idUnit of measurement`))
ENGINE = InnoDB
AUTO_INCREMENT = 3
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;


-- -----------------------------------------------------
-- Table `pozorisp3_Semenyakin`.`Requests_and_access2`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `pozorisp3_Semenyakin`.`Requests_and_access2` ;

CREATE TABLE IF NOT EXISTS `pozorisp3_Semenyakin`.`Requests_and_access2` (
  `idRequests_and_access2` INT NOT NULL,
  `Number of working hours` VARCHAR(45) NOT NULL,
  `Name` VARCHAR(45) NOT NULL,
  `Type` INT NOT NULL,
  `Supplier` INT NOT NULL,
  `Package` VARCHAR(45) NOT NULL,
  `Unit of measurement` INT NOT NULL,
  `price` VARCHAR(45) NOT NULL,
  `Remaining stock` VARCHAR(45) NOT NULL,
  `Minimum stock` VARCHAR(45) NOT NULL,
  `History of changes` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`idRequests_and_access2`),
  INDEX `Type_idx` (`Type` ASC) VISIBLE,
  INDEX `Supplier_idx` (`Supplier` ASC) VISIBLE,
  INDEX `Unit of measurement_idx` (`Unit of measurement` ASC) VISIBLE,
  CONSTRAINT `Supplier`
    FOREIGN KEY (`Supplier`)
    REFERENCES `pozorisp3_Semenyakin`.`Supplier` (`idSupplier`),
  CONSTRAINT `Type`
    FOREIGN KEY (`Type`)
    REFERENCES `pozorisp3_Semenyakin`.`Type` (`idType`),
  CONSTRAINT `Unit of measurement`
    FOREIGN KEY (`Unit of measurement`)
    REFERENCES `pozorisp3_Semenyakin`.`Unit of measurement` (`idUnit of measurement`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;


SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
