CREATE TABLE IF NOT EXISTS `task_activity_audit` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL,
  `nonce` varchar(64) NOT NULL,
  `activity` varchar(40) NOT NULL,
  `requested_target_id` varchar(80) NULL,
  `resolved_target_id` varchar(80) NULL,
  `accepted` boolean NOT NULL DEFAULT FALSE,
  `reason` varchar(120) NOT NULL,
  `session_id` varchar(80) NULL,
  `map_id` varchar(40) NULL,
  `position_x` float NULL,
  `position_y` float NULL,
  `client_ip` varchar(64) NULL,
  `user_agent` varchar(255) NULL,
  `client_occurred_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_task_activity_audit_user_created` (`user_id`, `created_at`),
  KEY `idx_task_activity_audit_nonce` (`user_id`, `nonce`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='任务活动校验审计';
