CREATE TABLE `teacher_read_durations`
(
    `id`             int            NOT NULL AUTO_INCREMENT,
    `user_id`        int            NOT NULL COMMENT '用户ID',
    `chapter_id`     int            NOT NULL COMMENT '书籍ID',
    `study_duration` decimal(10, 2) NOT NULL COMMENT '阅读时间，单位秒',
    `deleted`        tinyint(1) NULL DEFAULT 0 COMMENT '删除标记',
    `create_time`    datetime       NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time`    datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
    `create_by`      varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人',
    `update_by`      varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '修改人',
    `tenant_id`      varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '租户id',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX            `idx_user_id`(`user_id` ASC) USING BTREE,
    INDEX            `idx_chapter_id`(`chapter_id` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_german2_ci ROW_FORMAT = Dynamic;

CREATE TABLE `teacher_treasury_article_read_durations`
(
    `id`             int            NOT NULL AUTO_INCREMENT,
    `user_id`        int            NOT NULL COMMENT '用户ID',
    `article_id`     int            NOT NULL COMMENT '书籍ID',
    `study_duration` decimal(10, 2) NOT NULL COMMENT '阅读时间，单位秒',
    `deleted`        tinyint(1) NULL DEFAULT 0 COMMENT '删除标记',
    `create_time`    datetime       NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time`    datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
    `create_by`      varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人',
    `update_by`      varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '修改人',
    `tenant_id`      varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '租户id',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX            `idx_user_id`(`user_id` ASC) USING BTREE,
    INDEX            `idx_article_id_id`(`article_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_german2_ci ROW_FORMAT = DYNAMIC;
