-- MySQL dump 10.13  Distrib 8.0.36, for Win64 (x86_64)
--
-- Host: cfif31.ru    Database: ISPr25-21_NeshinaPV_0503
-- ------------------------------------------------------
-- Server version	8.0.45-0ubuntu0.24.04.1

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `comments`
--

DROP TABLE IF EXISTS `comments`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `comments` (
  `commentID` int NOT NULL AUTO_INCREMENT,
  `message` text NOT NULL,
  `masterID` int NOT NULL,
  `requestID` int NOT NULL,
  PRIMARY KEY (`commentID`),
  KEY `masterID` (`masterID`),
  KEY `requestID` (`requestID`),
  CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`masterID`) REFERENCES `users` (`userID`),
  CONSTRAINT `comments_ibfk_2` FOREIGN KEY (`requestID`) REFERENCES `requests` (`requestID`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `comments`
--

LOCK TABLES `comments` WRITE;
/*!40000 ALTER TABLE `comments` DISABLE KEYS */;
INSERT INTO `comments` VALUES (1,'Интересно...',2,1),(2,'Будем разбираться!',3,2),(3,'Сделаем всё на высшем уровне!',3,3);
/*!40000 ALTER TABLE `comments` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `request_statuses`
--

DROP TABLE IF EXISTS `request_statuses`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `request_statuses` (
  `statusID` int NOT NULL AUTO_INCREMENT,
  `statusName` varchar(100) NOT NULL,
  PRIMARY KEY (`statusID`),
  UNIQUE KEY `statusName` (`statusName`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `request_statuses`
--

LOCK TABLES `request_statuses` WRITE;
/*!40000 ALTER TABLE `request_statuses` DISABLE KEYS */;
INSERT INTO `request_statuses` VALUES (1,'В процессе ремонта'),(2,'Готова к выдаче'),(3,'Новая заявка');
/*!40000 ALTER TABLE `request_statuses` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `requests`
--

DROP TABLE IF EXISTS `requests`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `requests` (
  `requestID` int NOT NULL AUTO_INCREMENT,
  `startDate` date NOT NULL,
  `techTypeID` int NOT NULL,
  `orgTechModel` varchar(200) NOT NULL,
  `problemDescription` text,
  `statusID` int NOT NULL,
  `completionDate` date DEFAULT NULL,
  `repairParts` text,
  `masterID` int DEFAULT NULL,
  `clientID` int NOT NULL,
  PRIMARY KEY (`requestID`),
  KEY `techTypeID` (`techTypeID`),
  KEY `statusID` (`statusID`),
  KEY `masterID` (`masterID`),
  KEY `clientID` (`clientID`),
  CONSTRAINT `requests_ibfk_1` FOREIGN KEY (`techTypeID`) REFERENCES `tech_types` (`techTypeID`),
  CONSTRAINT `requests_ibfk_2` FOREIGN KEY (`statusID`) REFERENCES `request_statuses` (`statusID`),
  CONSTRAINT `requests_ibfk_3` FOREIGN KEY (`masterID`) REFERENCES `users` (`userID`),
  CONSTRAINT `requests_ibfk_4` FOREIGN KEY (`clientID`) REFERENCES `users` (`userID`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `requests`
--

LOCK TABLES `requests` WRITE;
/*!40000 ALTER TABLE `requests` DISABLE KEYS */;
INSERT INTO `requests` VALUES (1,'2023-06-06',1,'DEXP Aquilon O286','Перестал работать',1,NULL,NULL,2,7),(2,'2023-05-05',1,'DEXP Atlas H388','Перестал работать',1,NULL,NULL,3,8),(3,'2022-07-07',2,'MSI GF76 Katana 11UC-879XRU черный','Выключается',2,'2023-01-01',NULL,3,9),(4,'2023-08-02',2,'MSI Modern 15 B12M-211RU черный','Выключается',3,NULL,NULL,NULL,8),(5,'2023-08-02',3,'HP LaserJet Pro M404dn','Перестала включаться',3,NULL,NULL,NULL,9);
/*!40000 ALTER TABLE `requests` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tech_types`
--

DROP TABLE IF EXISTS `tech_types`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tech_types` (
  `techTypeID` int NOT NULL AUTO_INCREMENT,
  `techTypeName` varchar(100) NOT NULL,
  PRIMARY KEY (`techTypeID`),
  UNIQUE KEY `techTypeName` (`techTypeName`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tech_types`
--

LOCK TABLES `tech_types` WRITE;
/*!40000 ALTER TABLE `tech_types` DISABLE KEYS */;
INSERT INTO `tech_types` VALUES (1,'Компьютер'),(2,'Ноутбук'),(3,'Принтер');
/*!40000 ALTER TABLE `tech_types` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `user_types`
--

DROP TABLE IF EXISTS `user_types`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_types` (
  `typeID` int NOT NULL AUTO_INCREMENT,
  `typeName` varchar(50) NOT NULL,
  PRIMARY KEY (`typeID`),
  UNIQUE KEY `typeName` (`typeName`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `user_types`
--

LOCK TABLES `user_types` WRITE;
/*!40000 ALTER TABLE `user_types` DISABLE KEYS */;
INSERT INTO `user_types` VALUES (4,'Заказчик'),(2,'Мастер'),(1,'Менеджер'),(3,'Оператор');
/*!40000 ALTER TABLE `user_types` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `users`
--

DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `users` (
  `userID` int NOT NULL AUTO_INCREMENT,
  `fio` varchar(150) NOT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `login` varchar(50) NOT NULL,
  `password` varchar(100) NOT NULL,
  `typeID` int NOT NULL,
  PRIMARY KEY (`userID`),
  UNIQUE KEY `login` (`login`),
  KEY `typeID` (`typeID`),
  CONSTRAINT `users_ibfk_1` FOREIGN KEY (`typeID`) REFERENCES `user_types` (`typeID`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `users`
--

LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,'Носов Иван Михайлович','89210563128','login1','pass1',1),(2,'Ильин Александр Андреевич','89535078985','login2','pass2',2),(3,'Никифоров Иван Дмитриевич','89210673849','login3','pass3',2),(4,'Елисеев Артём Леонидович','89990563748','login4','pass4',3),(5,'Титов Сергей Кириллович','89994563847','login5','pass5',3),(6,'Григорьев Семён Викторович','89219567849','login11','pass11',4),(7,'Сорокин Дмитрий Ильич','89219567841','login12','pass12',4),(8,'Белоусов Егор Ярославович','89219567842','login13','pass13',4),(9,'Суслов Михаил Александрович','89219567843','login14','pass14',4),(10,'Васильев Вячеслав Александрович','89219567844','login15','pass15',2);
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2026-03-05 13:12:02
