-- MySQL Script generated by MySQL Workbench
-- Sat Nov 23 11:57:48 2024
-- 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
-- -----------------------------------------------------
SHOW WARNINGS;
-- -----------------------------------------------------
-- Schema ISPr24-38_IbragimovaDM_1TASK
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `ISPr24-38_IbragimovaDM_1TASK` ;

-- -----------------------------------------------------
-- Schema ISPr24-38_IbragimovaDM_1TASK
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `ISPr24-38_IbragimovaDM_1TASK` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci ;
SHOW WARNINGS;
-- -----------------------------------------------------
-- Schema ISPr24-38_IbragimovaDM_Hospital
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `ISPr24-38_IbragimovaDM_Hospital` ;

-- -----------------------------------------------------
-- Schema ISPr24-38_IbragimovaDM_Hospital
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `ISPr24-38_IbragimovaDM_Hospital` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci ;
SHOW WARNINGS;
USE `ISPr24-38_IbragimovaDM_1TASK` ;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_1TASK`.`Directrors`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_1TASK`.`Directrors` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_1TASK`.`Directrors` (
  `idDirectrors` INT NOT NULL AUTO_INCREMENT,
  `Name` VARCHAR(45) NOT NULL,
  `LastName` VARCHAR(45) NOT NULL,
  `Patronymic` VARCHAR(45) NOT NULL,
  `Email` VARCHAR(45) NOT NULL,
  `Phone` BIGINT NOT NULL,
  PRIMARY KEY (`idDirectrors`))
ENGINE = InnoDB
AUTO_INCREMENT = 6
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_1TASK`.`Material_type`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_1TASK`.`Material_type` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_1TASK`.`Material_type` (
  `idMaterial_type` INT NOT NULL AUTO_INCREMENT,
  `Type` VARCHAR(45) NOT NULL,
  `Precent` DECIMAL(10,4) NOT NULL,
  PRIMARY KEY (`idMaterial_type`))
ENGINE = InnoDB
AUTO_INCREMENT = 6
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_1TASK`.`Partner_type`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_1TASK`.`Partner_type` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_1TASK`.`Partner_type` (
  `idPartner_type` INT NOT NULL AUTO_INCREMENT,
  `Type` VARCHAR(10) NOT NULL,
  PRIMARY KEY (`idPartner_type`))
ENGINE = InnoDB
AUTO_INCREMENT = 4
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_1TASK`.`Partner_Company`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_1TASK`.`Partner_Company` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_1TASK`.`Partner_Company` (
  `idPartner_Company` INT NOT NULL AUTO_INCREMENT,
  `Name` VARCHAR(45) NOT NULL,
  `Partner_type_Id` INT NOT NULL,
  `Director_Id` INT NOT NULL,
  `EmailIndex` INT NOT NULL,
  `Address` VARCHAR(255) NOT NULL,
  `INN` BIGINT NOT NULL,
  `Rating` INT NOT NULL,
  PRIMARY KEY (`idPartner_Company`),
  CONSTRAINT `FK_Partner_company_type`
    FOREIGN KEY (`Partner_type_Id`)
    REFERENCES `ISPr24-38_IbragimovaDM_1TASK`.`Partner_type` (`idPartner_type`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT,
  CONSTRAINT `FK_Partner_DirectorId`
    FOREIGN KEY (`Director_Id`)
    REFERENCES `ISPr24-38_IbragimovaDM_1TASK`.`Directrors` (`idDirectrors`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT)
ENGINE = InnoDB
AUTO_INCREMENT = 6
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;
CREATE INDEX `FK_Partner_company_type_idx` ON `ISPr24-38_IbragimovaDM_1TASK`.`Partner_Company` (`Partner_type_Id` ASC) VISIBLE;

SHOW WARNINGS;
CREATE INDEX `FK_Partner_DirectorId_idx` ON `ISPr24-38_IbragimovaDM_1TASK`.`Partner_Company` (`Director_Id` ASC) VISIBLE;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_1TASK`.`Product_type`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_1TASK`.`Product_type` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_1TASK`.`Product_type` (
  `idProduct_type` INT NOT NULL AUTO_INCREMENT,
  `Type` VARCHAR(45) NOT NULL,
  `Coefficient` DECIMAL(10,2) NOT NULL,
  PRIMARY KEY (`idProduct_type`))
ENGINE = InnoDB
AUTO_INCREMENT = 5
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_1TASK`.`Product`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_1TASK`.`Product` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_1TASK`.`Product` (
  `Articul` INT NOT NULL,
  `Product_type_Id` INT NOT NULL,
  `Name` VARCHAR(255) NOT NULL,
  `MinPrice` DECIMAL(10,2) NOT NULL,
  `Product_Material_Id` INT NOT NULL,
  PRIMARY KEY (`Articul`),
  CONSTRAINT `FK_Product_Product_Material`
    FOREIGN KEY (`Product_Material_Id`)
    REFERENCES `ISPr24-38_IbragimovaDM_1TASK`.`Material_type` (`idMaterial_type`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT,
  CONSTRAINT `FK_Product_Product_Type`
    FOREIGN KEY (`Product_type_Id`)
    REFERENCES `ISPr24-38_IbragimovaDM_1TASK`.`Product_type` (`idProduct_type`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;
CREATE INDEX `FK_Product_Product_Type_idx` ON `ISPr24-38_IbragimovaDM_1TASK`.`Product` (`Product_type_Id` ASC) VISIBLE;

SHOW WARNINGS;
CREATE INDEX `FK_Product_Product_Material_idx` ON `ISPr24-38_IbragimovaDM_1TASK`.`Product` (`Product_Material_Id` ASC) VISIBLE;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_1TASK`.`Partner_Products`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_1TASK`.`Partner_Products` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_1TASK`.`Partner_Products` (
  `idPartner_Products` INT NOT NULL AUTO_INCREMENT,
  `Product_id` INT NOT NULL,
  `Partner_Id` INT NOT NULL,
  `Count_Product` VARCHAR(45) NOT NULL,
  `Date` DATE NOT NULL,
  PRIMARY KEY (`idPartner_Products`),
  CONSTRAINT `FK_Partner_Products_Partner`
    FOREIGN KEY (`Partner_Id`)
    REFERENCES `ISPr24-38_IbragimovaDM_1TASK`.`Partner_Company` (`idPartner_Company`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT,
  CONSTRAINT `FK_Partner_Products_Product`
    FOREIGN KEY (`Product_id`)
    REFERENCES `ISPr24-38_IbragimovaDM_1TASK`.`Product` (`Articul`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT)
ENGINE = InnoDB
AUTO_INCREMENT = 17
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;
CREATE INDEX `FK_Partner_Products_Product_idx` ON `ISPr24-38_IbragimovaDM_1TASK`.`Partner_Products` (`Product_id` ASC) VISIBLE;

SHOW WARNINGS;
CREATE INDEX `FK_Partner_Products_Partner_idx` ON `ISPr24-38_IbragimovaDM_1TASK`.`Partner_Products` (`Partner_Id` ASC) VISIBLE;

SHOW WARNINGS;
USE `ISPr24-38_IbragimovaDM_Hospital` ;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_Hospital`.`Department`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`Department` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`Department` (
  `Id` INT NOT NULL AUTO_INCREMENT,
  `Name` VARCHAR(100) NOT NULL,
  PRIMARY KEY (`Id`))
ENGINE = InnoDB
AUTO_INCREMENT = 11
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_Hospital`.`DrugProvider`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`DrugProvider` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`DrugProvider` (
  `Id` INT NOT NULL AUTO_INCREMENT,
  `Name` VARCHAR(45) NOT NULL,
  `Address` VARCHAR(255) NOT NULL,
  PRIMARY KEY (`Id`))
ENGINE = InnoDB
AUTO_INCREMENT = 8
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_Hospital`.`ManufacturerCountry`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`ManufacturerCountry` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`ManufacturerCountry` (
  `Id` INT NOT NULL AUTO_INCREMENT,
  `Country` VARCHAR(100) NOT NULL,
  PRIMARY KEY (`Id`))
ENGINE = InnoDB
AUTO_INCREMENT = 6
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_Hospital`.`Manufacturer`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`Manufacturer` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`Manufacturer` (
  `Id` INT NOT NULL AUTO_INCREMENT,
  `Name` VARCHAR(255) NOT NULL,
  `CountryId` INT NOT NULL,
  PRIMARY KEY (`Id`),
  CONSTRAINT `FK_Manufacturer_ManufacturerCountryId`
    FOREIGN KEY (`CountryId`)
    REFERENCES `ISPr24-38_IbragimovaDM_Hospital`.`ManufacturerCountry` (`Id`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT)
ENGINE = InnoDB
AUTO_INCREMENT = 8
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;
CREATE INDEX `FK_Manufacturer_ManufacturerCountryId_idx` ON `ISPr24-38_IbragimovaDM_Hospital`.`Manufacturer` (`CountryId` ASC) VISIBLE;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_Hospital`.`DrugType`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`DrugType` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`DrugType` (
  `Id` INT NOT NULL AUTO_INCREMENT,
  `Name` VARCHAR(100) NOT NULL,
  PRIMARY KEY (`Id`))
ENGINE = InnoDB
AUTO_INCREMENT = 12
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_Hospital`.`Drugs`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`Drugs` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`Drugs` (
  `Id` INT NOT NULL AUTO_INCREMENT,
  `Name` VARCHAR(255) NOT NULL,
  `ManufacturerId` INT NOT NULL,
  `DrugProviderId` INT NOT NULL,
  `Count` INT NULL DEFAULT NULL,
  `TypeId` INT NULL DEFAULT NULL,
  `Photo` LONGBLOB NULL DEFAULT NULL,
  PRIMARY KEY (`Id`),
  CONSTRAINT `FK_Drugs_DrugProviderId`
    FOREIGN KEY (`DrugProviderId`)
    REFERENCES `ISPr24-38_IbragimovaDM_Hospital`.`DrugProvider` (`Id`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT,
  CONSTRAINT `FK_Drugs_ManufacturerId`
    FOREIGN KEY (`ManufacturerId`)
    REFERENCES `ISPr24-38_IbragimovaDM_Hospital`.`Manufacturer` (`Id`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT,
  CONSTRAINT `FK_Drugs_TypeId`
    FOREIGN KEY (`TypeId`)
    REFERENCES `ISPr24-38_IbragimovaDM_Hospital`.`DrugType` (`Id`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT)
ENGINE = InnoDB
AUTO_INCREMENT = 39
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;
CREATE INDEX `FK_Drugs_ManufacturerId_idx` ON `ISPr24-38_IbragimovaDM_Hospital`.`Drugs` (`ManufacturerId` ASC) VISIBLE;

SHOW WARNINGS;
CREATE INDEX `FK_Drugs_DrugProviderId_idx` ON `ISPr24-38_IbragimovaDM_Hospital`.`Drugs` (`DrugProviderId` ASC) VISIBLE;

SHOW WARNINGS;
CREATE INDEX `FK_Drugs_TypeId_idx` ON `ISPr24-38_IbragimovaDM_Hospital`.`Drugs` (`TypeId` ASC) VISIBLE;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_Hospital`.`JobTitle`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`JobTitle` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`JobTitle` (
  `Id` INT NOT NULL AUTO_INCREMENT,
  `TItle` VARCHAR(60) NOT NULL,
  `DepartmentId` INT NOT NULL,
  PRIMARY KEY (`Id`),
  CONSTRAINT `FK_JobTitle_DepartmentId`
    FOREIGN KEY (`DepartmentId`)
    REFERENCES `ISPr24-38_IbragimovaDM_Hospital`.`Department` (`Id`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT)
ENGINE = InnoDB
AUTO_INCREMENT = 18
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;
CREATE INDEX `FK_JobTitle_DepartmentId_idx` ON `ISPr24-38_IbragimovaDM_Hospital`.`JobTitle` (`DepartmentId` ASC) VISIBLE;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_Hospital`.`Role`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`Role` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`Role` (
  `Id` INT NOT NULL AUTO_INCREMENT,
  `Role` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`Id`))
ENGINE = InnoDB
AUTO_INCREMENT = 3
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_Hospital`.`Users`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`Users` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`Users` (
  `Id` INT NOT NULL AUTO_INCREMENT,
  `Login` VARCHAR(45) NOT NULL,
  `Password` VARCHAR(45) NOT NULL,
  `RoleId` INT NOT NULL,
  PRIMARY KEY (`Id`),
  CONSTRAINT `FK_Users_RoleId`
    FOREIGN KEY (`RoleId`)
    REFERENCES `ISPr24-38_IbragimovaDM_Hospital`.`Role` (`Id`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT)
ENGINE = InnoDB
AUTO_INCREMENT = 21
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;
CREATE INDEX `FK_Users_RoleId_idx` ON `ISPr24-38_IbragimovaDM_Hospital`.`Users` (`RoleId` ASC) VISIBLE;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_Hospital`.`Workers`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`Workers` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`Workers` (
  `Id` INT NOT NULL AUTO_INCREMENT,
  `FullName` VARCHAR(255) NOT NULL,
  `JobTitleId` INT NOT NULL,
  `UserId` INT NOT NULL,
  PRIMARY KEY (`Id`),
  CONSTRAINT `FK_Workers_JobTitleId`
    FOREIGN KEY (`JobTitleId`)
    REFERENCES `ISPr24-38_IbragimovaDM_Hospital`.`JobTitle` (`Id`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT,
  CONSTRAINT `FK_Workers_UserId`
    FOREIGN KEY (`UserId`)
    REFERENCES `ISPr24-38_IbragimovaDM_Hospital`.`Users` (`Id`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT)
ENGINE = InnoDB
AUTO_INCREMENT = 21
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;
CREATE INDEX `FK_Workers_JobTitleId_idx` ON `ISPr24-38_IbragimovaDM_Hospital`.`Workers` (`JobTitleId` ASC) VISIBLE;

SHOW WARNINGS;
CREATE INDEX `FK_Workers_UserId_idx` ON `ISPr24-38_IbragimovaDM_Hospital`.`Workers` (`UserId` ASC) VISIBLE;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_Hospital`.`DispensingDrugs`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`DispensingDrugs` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`DispensingDrugs` (
  `Id` INT NOT NULL AUTO_INCREMENT,
  `DrugId` INT NOT NULL,
  `WorkerId` INT NOT NULL,
  `Date` DATE NOT NULL,
  `Count` INT NOT NULL,
  PRIMARY KEY (`Id`),
  CONSTRAINT `FK_DispendingDrugs_DrugId`
    FOREIGN KEY (`DrugId`)
    REFERENCES `ISPr24-38_IbragimovaDM_Hospital`.`Drugs` (`Id`)
    ON DELETE CASCADE
    ON UPDATE CASCADE,
  CONSTRAINT `FK_DispendingDrugs_WorkerId`
    FOREIGN KEY (`WorkerId`)
    REFERENCES `ISPr24-38_IbragimovaDM_Hospital`.`Workers` (`Id`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT)
ENGINE = InnoDB
AUTO_INCREMENT = 45
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;
CREATE INDEX `FK_DispendingDrugs_DrugId_idx` ON `ISPr24-38_IbragimovaDM_Hospital`.`DispensingDrugs` (`DrugId` ASC) VISIBLE;

SHOW WARNINGS;
CREATE INDEX `FK_DispendingDrugs_WorkerId_idx` ON `ISPr24-38_IbragimovaDM_Hospital`.`DispensingDrugs` (`WorkerId` ASC) VISIBLE;

SHOW WARNINGS;

-- -----------------------------------------------------
-- Table `ISPr24-38_IbragimovaDM_Hospital`.`ReceivingDrugs`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`ReceivingDrugs` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `ISPr24-38_IbragimovaDM_Hospital`.`ReceivingDrugs` (
  `Id` INT NOT NULL AUTO_INCREMENT,
  `DrugId` INT NOT NULL,
  `WorkerId` INT NOT NULL,
  `Date` DATE NOT NULL,
  `Count` INT NOT NULL,
  PRIMARY KEY (`Id`),
  CONSTRAINT `FK_ReceivingDrugs_DrugId`
    FOREIGN KEY (`DrugId`)
    REFERENCES `ISPr24-38_IbragimovaDM_Hospital`.`Drugs` (`Id`)
    ON DELETE CASCADE
    ON UPDATE CASCADE,
  CONSTRAINT `FK_ReceivingDrugs_WorkerId`
    FOREIGN KEY (`WorkerId`)
    REFERENCES `ISPr24-38_IbragimovaDM_Hospital`.`Workers` (`Id`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT)
ENGINE = InnoDB
AUTO_INCREMENT = 47
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

SHOW WARNINGS;
CREATE INDEX `FK_ReceivingDrugs_DrugId_idx` ON `ISPr24-38_IbragimovaDM_Hospital`.`ReceivingDrugs` (`DrugId` ASC) VISIBLE;

SHOW WARNINGS;
CREATE INDEX `FK_ReceivingDrugs_WorkerId_idx` ON `ISPr24-38_IbragimovaDM_Hospital`.`ReceivingDrugs` (`WorkerId` ASC) VISIBLE;

SHOW WARNINGS;

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