Files
zt-closet-backend/pkg/migration/000018_create_closet_share_receivers.up.sql
T
2026-09-11 01:41:52 +08:00

16 lines
1.1 KiB
SQL

-- 衣柜分享接收人关联表:记录"谁收到了谁的分享"(访问即视为收到,一对多、幂等)。
CREATE TABLE `closet_share_receivers` (
`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 '删除人',
`share_uuid` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '分享UUID',
`receiver_user_id` BIGINT NOT NULL DEFAULT 0 COMMENT '接收人用户ID',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_closet_share_receiver` (`share_uuid`, `receiver_user_id`),
KEY `idx_closet_share_receivers_user` (`receiver_user_id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '衣柜分享接收人关联表';