migrate_course_sys/1782712612_create_user_course.up.sql
2026-06-29 14:55:25 +08:00

11 lines
683 B
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CREATE TABLE `user_course` (
`id` BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '关联记录ID',
`user_id` INT NOT NULL COMMENT '用户ID',
`course_id` INT NOT NULL COMMENT '月度课程ID',
`status` TINYINT DEFAULT 1 COMMENT '学习状态1-未开始 2-学习中 3-已完成',
`study_num` INT DEFAULT 0 COMMENT '已学习数量',
`total_num` INT DEFAULT 0 COMMENT '总视频数量',
`created_at` TIMESTAMP NUll DEFAULT NULL COMMENT '创建时间',
`updated_at` TIMESTAMP NUll DEFAULT NULL COMMENT '更新时间',
UNIQUE KEY `uk_user_course` (`user_id`, `course_id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '用户与课程关联表';