-- MySQL dump 10.13  Distrib 8.0.36, for Win64 (x86_64)
--
-- Host: cfif31.ru    Database: ISPr25-21_NeshinaPV_1003
-- ------------------------------------------------------
-- 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` (
  `comment_id` int NOT NULL,
  `message` text NOT NULL,
  `master_id` int NOT NULL,
  `request_id` int NOT NULL,
  PRIMARY KEY (`comment_id`),
  KEY `master_id` (`master_id`),
  KEY `request_id` (`request_id`),
  CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`master_id`) REFERENCES `users` (`user_id`),
  CONSTRAINT `comments_ibfk_2` FOREIGN KEY (`request_id`) REFERENCES `requests` (`request_id`)
) ENGINE=InnoDB 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` (
  `status_id` int NOT NULL AUTO_INCREMENT,
  `status_name` varchar(100) NOT NULL,
  PRIMARY KEY (`status_id`),
  UNIQUE KEY `status_name` (`status_name`)
) 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` (
  `request_id` int NOT NULL,
  `start_date` date NOT NULL,
  `tech_type_id` int NOT NULL,
  `climate_tech_model` varchar(150) DEFAULT NULL,
  `problem_description` text,
  `status_id` int NOT NULL,
  `completion_date` date DEFAULT NULL,
  `repair_parts` text,
  `master_id` int DEFAULT NULL,
  `client_id` int NOT NULL,
  PRIMARY KEY (`request_id`),
  KEY `tech_type_id` (`tech_type_id`),
  KEY `status_id` (`status_id`),
  KEY `master_id` (`master_id`),
  KEY `client_id` (`client_id`),
  CONSTRAINT `requests_ibfk_1` FOREIGN KEY (`tech_type_id`) REFERENCES `tech_types` (`tech_type_id`),
  CONSTRAINT `requests_ibfk_2` FOREIGN KEY (`status_id`) REFERENCES `request_statuses` (`status_id`),
  CONSTRAINT `requests_ibfk_3` FOREIGN KEY (`master_id`) REFERENCES `users` (`user_id`),
  CONSTRAINT `requests_ibfk_4` FOREIGN KEY (`client_id`) REFERENCES `users` (`user_id`)
) ENGINE=InnoDB 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,'TCL TAC-12CHSA/TPG-W белый','Не охлаждает воздух',1,NULL,NULL,2,7),(2,'2023-05-05',1,'Electrolux EACS/I-09HAT/N3_21Y белый','Выключается сам по себе',1,NULL,NULL,3,8),(3,'2022-07-07',2,'Xiaomi Smart Humidifier 2','Пар имеет неприятный запах',2,'2023-01-01',NULL,3,9),(4,'2023-08-02',2,'Polaris PUH 2300 WIFI IQ Home','Увлажнитель воздуха продолжает работать при предельном снижении уровня воды',3,NULL,NULL,NULL,8),(5,'2023-08-02',3,'Ballu BAHD-1250','Не работает',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` (
  `tech_type_id` int NOT NULL AUTO_INCREMENT,
  `tech_type_name` varchar(100) NOT NULL,
  PRIMARY KEY (`tech_type_id`),
  UNIQUE KEY `tech_type_name` (`tech_type_name`)
) 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,'Кондиционер'),(3,'Сушилка для рук'),(2,'Увлажнитель воздуха');
/*!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` (
  `type_id` int NOT NULL AUTO_INCREMENT,
  `type_name` varchar(50) NOT NULL,
  PRIMARY KEY (`type_id`),
  UNIQUE KEY `type_name` (`type_name`)
) 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,'Заказчик'),(1,'Менеджер'),(3,'Оператор'),(2,'Специалист');
/*!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` (
  `user_id` int NOT NULL,
  `fio` varchar(100) NOT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `login` varchar(50) NOT NULL,
  `password` varchar(100) NOT NULL,
  `type_id` int NOT NULL,
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `login` (`login`),
  KEY `type_id` (`type_id`),
  CONSTRAINT `users_ibfk_1` FOREIGN KEY (`type_id`) REFERENCES `user_types` (`type_id`)
) ENGINE=InnoDB 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','login6','pass6',4),(7,'Петров Никита Артёмович','89219567841','login7','pass7',4),(8,'Ковалева Софья Владимировна','89219567842','login8','pass8',4),(9,'Кузнецов Сергей Матвеевич','89219567843','login9','pass9',4),(10,'Беспалова Екатерина Даниэльевна','89219567844','login10','pass10',2),(11,'1','1','1','1',1),(12,'2','2','2','2',2),(13,'3','3','3','3',3),(14,'4','4','4','4',4);
/*!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-10 12:43:56
