16 lines
852 B
SQL
16 lines
852 B
SQL
CREATE TABLE IF NOT EXISTS `sys_user_mcp` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`user_id` int(11) NOT NULL,
|
|
`bot_id` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
|
|
`bot_secret` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
|
|
`status` tinyint(1) NOT NULL DEFAULT 1,
|
|
`last_used_at` datetime DEFAULT NULL,
|
|
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `uk_sys_user_mcp_user_id` (`user_id`),
|
|
UNIQUE KEY `uk_sys_user_mcp_bot_id` (`bot_id`),
|
|
KEY `idx_sys_user_mcp_status` (`status`),
|
|
CONSTRAINT `fk_sys_user_mcp_user` FOREIGN KEY (`user_id`) REFERENCES `sys_users` (`user_id`) ON DELETE CASCADE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户MCP接入凭证';
|