14 lines
1.1 KiB
SQL
14 lines
1.1 KiB
SQL
-- spdm_baseline.sys_user_relation definition
|
|
|
|
CREATE TABLE `sys_user_relation` (
|
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
|
`user_id` bigint NOT NULL COMMENT '主动方用户ID',
|
|
`related_user_id` bigint NOT NULL COMMENT '被动方用户ID',
|
|
`relation_type` smallint NOT NULL DEFAULT '1' COMMENT '关系类型: 1-负责人与下属',
|
|
`tenant_id` bigint DEFAULT NULL COMMENT '租户ID',
|
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `uk_user_relation` (`user_id`,`related_user_id`,`relation_type`),
|
|
KEY `idx_user_id` (`user_id`),
|
|
KEY `idx_related_user_id` (`related_user_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户关系表'; |