/*
 Navicat Premium Dump SQL

 Source Server         : 亿速云（国内）
 Source Server Type    : MySQL
 Source Server Version : 80018 (8.0.18)
 Source Host           : yisurds-66dc0b453c05d4.rds.ysydb1.com:14080
 Source Schema         : LMS_TEST

 Target Server Type    : MySQL
 Target Server Version : 80018 (8.0.18)
 File Encoding         : 65001

 Date: 11/06/2025 13:55:58
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for MJApiTokenUsage
-- ----------------------------
DROP TABLE IF EXISTS `MJApiTokenUsage`;
CREATE TABLE `MJApiTokenUsage`  (
  `TokenId` bigint(20) NOT NULL,
  `Date` date NOT NULL,
  `DailyUsage` int(11) NOT NULL DEFAULT 0 COMMENT '当日使用量',
  `TotalUsage` int(11) NOT NULL DEFAULT 0 COMMENT '累计使用量',
  `LastActivityAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后活动时间',
  `HistoryUse` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '使用记录',
  PRIMARY KEY (`TokenId`) USING BTREE,
  INDEX `IdxLastActivity`(`LastActivityAt` ASC) USING BTREE,
  CONSTRAINT `MJApiTokenUsage_ibfk_1` FOREIGN KEY (`TokenId`) REFERENCES `MJApiTokens` (`Id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '令牌使用统计表' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;
