migrate_course_sys/1783392382_create_notification.up.sql
2026-07-07 11:28:47 +08:00

15 lines
978 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 `notification` (
`id` BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '通知ID',
`user_id` INT NOT NULL COMMENT '接收通知的用户ID',
`type` VARCHAR(30) NOT NULL COMMENT '通知类型',
`title` VARCHAR(255) NOT NULL COMMENT '通知标题',
`content` TEXT COMMENT '通知正文',
`link_url` VARCHAR(500) COMMENT '点击通知后的跳转链接',
`target_type` VARCHAR(30) COMMENT '关联目标类型(如 comment/course/video',
`target_id` INT COMMENT '关联目标ID如评论ID、课程ID',
`is_read` TINYINT DEFAULT 1 COMMENT '是否已读1-未读 2-已读',
`read_time` DATETIME COMMENT '阅读时间',
`sender_id` INT COMMENT '触发通知的用户ID如回复者系统通知则为NULL',
`created_at` TIMESTAMP NUll DEFAULT NULL COMMENT '创建时间',
`updated_at` TIMESTAMP NUll DEFAULT NULL COMMENT '更新时间'
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '用户通知表';