-- =============================================================
-- Дамп Highload-блоков: Клубы / Сезоны / Игроки / Связки
-- БД: client11_cap_new
-- Сгенерирован: 2026-05-04 01:43:57
-- =============================================================



CREATE TABLE `hl_club` (
  `ID` bigint NOT NULL AUTO_INCREMENT,
  `UF_NAME_RU` varchar(255) NOT NULL,
  `UF_NAME_EN` varchar(255) NOT NULL,
  `UF_CITY_RU` varchar(255) NOT NULL,
  `UF_CITY_EN` varchar(255) NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ux_club_name_en` (`UF_NAME_EN`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

INSERT INTO `hl_club` VALUES (1,'ЦСКА','CSKA','Москва','Moscow'),(2,'Динамо','Dynamo','Москва','Moscow'),(3,'СКА','SKA','Санкт-Петербург','Saint Petersburg'),(4,'Локомотив','Lokomotiv','Ярославль','Yaroslavl'),(5,'Металлург','Metallurg','Магнитогорск','Magnitogorsk'),(6,'Ак Барс','Ak Bars','Казань','Kazan');

CREATE TABLE `hl_season` (
  `ID` bigint NOT NULL AUTO_INCREMENT,
  `UF_NAME` varchar(50) NOT NULL,
  `UF_YEAR_START` int NOT NULL,
  `UF_YEAR_END` int NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ux_season_name` (`UF_NAME`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

INSERT INTO `hl_season` VALUES (1,'2024/2025',2024,2025),(2,'2025/2026',2025,2026);

CREATE TABLE `hl_player` (
  `ID` bigint NOT NULL AUTO_INCREMENT,
  `UF_FIO_RU` varchar(255) NOT NULL,
  `UF_FIO_EN` varchar(255) NOT NULL,
  `UF_WEIGHT` decimal(5,2) DEFAULT NULL,
  `UF_HEIGHT` int DEFAULT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ux_player_fio_en` (`UF_FIO_EN`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

INSERT INTO `hl_player` VALUES (1,'Шипачёв Вадим Викторович','Vadim Shipachyov',86.00,184),(2,'Гусев Никита Игоревич','Nikita Gusev',80.00,178),(3,'Яшкин Дмитрий Викторович','Dmitri Yashkin',95.00,192),(4,'Радулов Александр Валерьевич','Alexander Radulov',96.00,188),(5,'Григоренко Михаил Игоревич','Mikhail Grigorenko',100.00,196),(6,'Толчинский Сергей Александрович','Sergei Tolchinsky',78.00,173),(7,'Кадейкин Александр Михайлович','Alexander Kadeykin',90.00,188),(8,'Кагарлицкий Дмитрий Юрьевич','Dmitry Kagarlitsky',85.00,178),(9,'Барабанов Александр Юрьевич','Alexander Barabanov',84.00,178),(10,'Каменев Владислав Валерьевич','Vladislav Kamenev',91.00,188);

CREATE TABLE `hl_player_season_club` (
  `ID` bigint NOT NULL AUTO_INCREMENT,
  `UF_PLAYER` bigint NOT NULL,
  `UF_SEASON` bigint NOT NULL,
  `UF_CLUB` bigint NOT NULL,
  `UF_JERSEY` int NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ux_psc_season_club_jersey` (`UF_SEASON`,`UF_CLUB`,`UF_JERSEY`),
  KEY `ix_psc_player` (`UF_PLAYER`),
  KEY `fk_psc_club` (`UF_CLUB`),
  CONSTRAINT `fk_psc_club` FOREIGN KEY (`UF_CLUB`) REFERENCES `hl_club` (`ID`) ON DELETE CASCADE,
  CONSTRAINT `fk_psc_player` FOREIGN KEY (`UF_PLAYER`) REFERENCES `hl_player` (`ID`) ON DELETE CASCADE,
  CONSTRAINT `fk_psc_season` FOREIGN KEY (`UF_SEASON`) REFERENCES `hl_season` (`ID`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

INSERT INTO `hl_player_season_club` VALUES (1,1,1,2,87),(2,1,2,2,87),(3,2,1,2,97),(4,2,2,2,97),(5,3,1,2,19),(6,3,2,2,19),(7,4,1,4,47),(8,4,2,4,47),(9,5,1,3,25),(10,5,2,3,25),(11,6,1,1,75),(12,6,2,3,17),(13,7,1,5,26),(14,7,2,5,26),(15,8,1,5,17),(16,8,2,1,17),(17,9,1,3,94),(18,9,2,3,94),(19,10,1,6,96),(20,10,2,6,96);


-- -------------------------------------------------------------
-- Регистрация HL-блоков и UF-полей
-- -------------------------------------------------------------


REPLACE INTO `b_hlblock_entity` VALUES (2,'Club','hl_club'),(3,'Season','hl_season'),(4,'Player','hl_player'),(5,'PlayerSeasonClub','hl_player_season_club');



REPLACE INTO `b_user_field` VALUES (16,'HLBLOCK_2','UF_NAME_RU','string','UF_NAME_RU',200,'N','Y','E','Y','Y','N','a:5:{s:4:\"SIZE\";i:50;s:4:\"ROWS\";i:1;s:10:\"MIN_LENGTH\";i:0;s:10:\"MAX_LENGTH\";i:0;s:13:\"DEFAULT_VALUE\";s:0:\"\";}'),(17,'HLBLOCK_2','UF_NAME_EN','string','UF_NAME_EN',300,'N','Y','E','Y','Y','N','a:5:{s:4:\"SIZE\";i:50;s:4:\"ROWS\";i:1;s:10:\"MIN_LENGTH\";i:0;s:10:\"MAX_LENGTH\";i:0;s:13:\"DEFAULT_VALUE\";s:0:\"\";}'),(18,'HLBLOCK_2','UF_CITY_RU','string','UF_CITY_RU',400,'N','Y','E','Y','Y','N','a:5:{s:4:\"SIZE\";i:50;s:4:\"ROWS\";i:1;s:10:\"MIN_LENGTH\";i:0;s:10:\"MAX_LENGTH\";i:0;s:13:\"DEFAULT_VALUE\";s:0:\"\";}'),(19,'HLBLOCK_2','UF_CITY_EN','string','UF_CITY_EN',500,'N','Y','E','Y','Y','N','a:5:{s:4:\"SIZE\";i:50;s:4:\"ROWS\";i:1;s:10:\"MIN_LENGTH\";i:0;s:10:\"MAX_LENGTH\";i:0;s:13:\"DEFAULT_VALUE\";s:0:\"\";}'),(23,'HLBLOCK_3','UF_NAME','string','UF_NAME',200,'N','Y','E','Y','Y','N','a:5:{s:4:\"SIZE\";i:50;s:4:\"ROWS\";i:1;s:10:\"MIN_LENGTH\";i:0;s:10:\"MAX_LENGTH\";i:0;s:13:\"DEFAULT_VALUE\";s:0:\"\";}'),(24,'HLBLOCK_3','UF_YEAR_START','integer','UF_YEAR_START',300,'N','Y','E','Y','Y','N','a:4:{s:4:\"SIZE\";i:20;s:9:\"MIN_VALUE\";i:0;s:9:\"MAX_VALUE\";i:0;s:13:\"DEFAULT_VALUE\";i:0;}'),(25,'HLBLOCK_3','UF_YEAR_END','integer','UF_YEAR_END',400,'N','Y','E','Y','Y','N','a:4:{s:4:\"SIZE\";i:20;s:9:\"MIN_VALUE\";i:0;s:9:\"MAX_VALUE\";i:0;s:13:\"DEFAULT_VALUE\";i:0;}'),(26,'HLBLOCK_4','UF_FIO_RU','string','UF_FIO_RU',200,'N','Y','E','Y','Y','N','a:5:{s:4:\"SIZE\";i:50;s:4:\"ROWS\";i:1;s:10:\"MIN_LENGTH\";i:0;s:10:\"MAX_LENGTH\";i:0;s:13:\"DEFAULT_VALUE\";s:0:\"\";}'),(27,'HLBLOCK_4','UF_FIO_EN','string','UF_FIO_EN',300,'N','Y','E','Y','Y','N','a:5:{s:4:\"SIZE\";i:50;s:4:\"ROWS\";i:1;s:10:\"MIN_LENGTH\";i:0;s:10:\"MAX_LENGTH\";i:0;s:13:\"DEFAULT_VALUE\";s:0:\"\";}'),(28,'HLBLOCK_4','UF_WEIGHT','double','UF_WEIGHT',400,'N','N','E','Y','Y','N','a:5:{s:9:\"PRECISION\";i:2;s:4:\"SIZE\";i:20;s:9:\"MIN_VALUE\";d:0;s:9:\"MAX_VALUE\";d:0;s:13:\"DEFAULT_VALUE\";d:0;}'),(29,'HLBLOCK_4','UF_HEIGHT','integer','UF_HEIGHT',500,'N','N','E','Y','Y','N','a:4:{s:4:\"SIZE\";i:20;s:9:\"MIN_VALUE\";i:0;s:9:\"MAX_VALUE\";i:0;s:13:\"DEFAULT_VALUE\";i:0;}'),(33,'HLBLOCK_5','UF_PLAYER','integer','UF_PLAYER',200,'N','Y','E','Y','Y','N','a:4:{s:4:\"SIZE\";i:20;s:9:\"MIN_VALUE\";i:0;s:9:\"MAX_VALUE\";i:0;s:13:\"DEFAULT_VALUE\";i:0;}'),(34,'HLBLOCK_5','UF_SEASON','integer','UF_SEASON',300,'N','Y','E','Y','Y','N','a:4:{s:4:\"SIZE\";i:20;s:9:\"MIN_VALUE\";i:0;s:9:\"MAX_VALUE\";i:0;s:13:\"DEFAULT_VALUE\";i:0;}'),(35,'HLBLOCK_5','UF_CLUB','integer','UF_CLUB',400,'N','Y','E','Y','Y','N','a:4:{s:4:\"SIZE\";i:20;s:9:\"MIN_VALUE\";i:0;s:9:\"MAX_VALUE\";i:0;s:13:\"DEFAULT_VALUE\";i:0;}'),(36,'HLBLOCK_5','UF_JERSEY','integer','UF_JERSEY',500,'N','Y','E','Y','Y','N','a:4:{s:4:\"SIZE\";i:20;s:9:\"MIN_VALUE\";i:0;s:9:\"MAX_VALUE\";i:0;s:13:\"DEFAULT_VALUE\";i:0;}');


