CREATE TABLE `ratings_copy` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `ctime` timestamp NOT NULL DEFAULT current_timestamp(),
  `order_id` int(10) unsigned NOT NULL,
  `client_id` int(10) unsigned DEFAULT NULL,
  `courier_id` int(10) unsigned DEFAULT NULL,
  `dispatcher_id` int(10) unsigned DEFAULT NULL,
  `point_id` int(10) unsigned DEFAULT NULL,
  `problem_id` int(10) unsigned DEFAULT NULL,
  `courier_rating` int(11) DEFAULT NULL COMMENT 'Оценка курьера клиентом',
  `courier_rating_comment` text CHARACTER SET utf8 DEFAULT NULL COMMENT 'Отзыв клиента',
  `actual_rating` int(11) DEFAULT NULL,
  `dispatcher_comment` text CHARACTER SET utf8 DEFAULT NULL COMMENT 'Комментарий диспетчера',
  PRIMARY KEY (`id`),
  UNIQUE KEY `problem_id` (`problem_id`),
  KEY `courier_id` (`courier_id`),
  KEY `order_id` (`order_id`),
  KEY `client_id` (`client_id`),
  KEY `idx_dispatcher_comment_courier_rating` (`dispatcher_comment`(1),`courier_rating`),
  KEY `idx_courier_rating_comment_courier_rating` (`courier_rating_comment`(1),`courier_rating`),
  KEY `idx_courier_rating` (`courier_rating`),
  KEY `courier_client` (`courier_id`,`client_id`),
  KEY `client_id_rating_ctime` (`client_id`,`courier_rating`,`ctime`)
) ENGINE=InnoDB AUTO_INCREMENT=14807 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Оценка качества услуг клиентом';
