CREATE TABLE `live_analysis_runtime` (
  `id` int AUTO_INCREMENT NOT NULL,
  `userId` int NOT NULL,
  `ownerSid` varchar(96),
  `status` enum('idle','active','ended') NOT NULL DEFAULT 'idle',
  `title` varchar(256),
  `sessionMode` enum('practice','pk') NOT NULL DEFAULT 'practice',
  `mediaSessionId` varchar(96),
  `startedAt` timestamp,
  `endedAt` timestamp,
  `lastHeartbeatAt` timestamp,
  `snapshot` json,
  `createdAt` timestamp NOT NULL DEFAULT (now()),
  `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
  CONSTRAINT `live_analysis_runtime_id` PRIMARY KEY(`id`),
  CONSTRAINT `live_analysis_runtime_user_idx` UNIQUE(`userId`)
);
