21 lines
1.5 KiB
SQL
21 lines
1.5 KiB
SQL
CREATE TABLE `user_notifications` (
|
|
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
|
`created_at` BIGINT NOT NULL DEFAULT 0 COMMENT '创建时间',
|
|
`updated_at` BIGINT NOT NULL DEFAULT 0 COMMENT '更新时间',
|
|
`deleted_at` BIGINT NOT NULL DEFAULT 0 COMMENT '删除时间(0 表示未删除)',
|
|
`created_by` BIGINT NOT NULL DEFAULT 0 COMMENT '创建人',
|
|
`updated_by` BIGINT NOT NULL DEFAULT 0 COMMENT '更新人',
|
|
`deleted_by` BIGINT NOT NULL DEFAULT 0 COMMENT '删除人',
|
|
`notification_uuid` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '消息UUID',
|
|
`user_id` BIGINT NOT NULL DEFAULT 0 COMMENT '接收用户ID',
|
|
`msg_type` TINYINT NOT NULL DEFAULT 0 COMMENT '消息类型 1=点赞通知 2=订单通知 3=系统通知',
|
|
`sender_id` BIGINT NOT NULL DEFAULT 0 COMMENT '发送者ID 系统消息为0',
|
|
`title` VARCHAR(128) NOT NULL DEFAULT '' COMMENT '消息标题',
|
|
`content` TEXT COMMENT '消息内容',
|
|
`is_read` TINYINT NOT NULL DEFAULT 0 COMMENT '是否已读 1=未读 2=已读',
|
|
`read_time` BIGINT NOT NULL DEFAULT 0 COMMENT '阅读时间',
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `uk_notification_uuid` (`notification_uuid`),
|
|
KEY `idx_notifications_user_read` (`user_id`, `is_read`)
|
|
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '用户通知表';
|