CREATE TABLE IF NOT EXISTS `story_share_metric` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `share_id` varchar(64) NOT NULL,
  `view_count` bigint NOT NULL DEFAULT '0',
  `comment_count` bigint NOT NULL DEFAULT '0',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_story_share_metric_share_id` (`share_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

CREATE TABLE IF NOT EXISTS `story_share_comment` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `instance_id` varchar(64) NOT NULL,
  `share_id` varchar(64) NOT NULL,
  `visitor_name` varchar(40) NOT NULL,
  `content` varchar(280) NOT NULL,
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_story_share_comment_instance_id` (`instance_id`),
  KEY `idx_story_share_comment_share_id` (`share_id`, `is_delete`, `create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
