38 lines
2.0 KiB
SQL
38 lines
2.0 KiB
SQL
-- 平台端和租户后台密码存储表。支持一个平台下挂载多个账号(每个账号包含账号、密码、注册信息、备注)。
|
|
CREATE TABLE IF NOT EXISTS `yz_platform_password_store` (
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
`platform` varchar(100) NOT NULL DEFAULT '' COMMENT '平台名称',
|
|
`url` varchar(500) NOT NULL DEFAULT '' COMMENT '平台网址/登录地址',
|
|
`accounts` longtext COMMENT '账号列表JSON: [{"username":"","password":"","registration_info":"","remark":""}]',
|
|
`remark` text COMMENT '平台备注',
|
|
`user_id` bigint unsigned NOT NULL COMMENT '所属用户ID',
|
|
`is_deleted` tinyint NOT NULL DEFAULT 0,
|
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
`update_time` datetime DEFAULT NULL,
|
|
`delete_time` datetime DEFAULT NULL,
|
|
PRIMARY KEY (`id`),
|
|
KEY `idx_platform_user` (`platform`,`user_id`),
|
|
KEY `idx_user_deleted` (`user_id`,`is_deleted`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='平台密码存储';
|
|
|
|
CREATE TABLE IF NOT EXISTS `yz_backend_password_store` (
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
`tid` bigint NOT NULL COMMENT '租户ID',
|
|
`platform` varchar(100) NOT NULL DEFAULT '' COMMENT '平台名称',
|
|
`url` varchar(500) NOT NULL DEFAULT '' COMMENT '平台网址/登录地址',
|
|
`accounts` longtext COMMENT '账号列表JSON: [{"username":"","password":"","registration_info":"","remark":""}]',
|
|
`remark` text COMMENT '平台备注',
|
|
`user_id` bigint unsigned NOT NULL COMMENT '所属用户ID',
|
|
`is_deleted` tinyint NOT NULL DEFAULT 0,
|
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
`update_time` datetime DEFAULT NULL,
|
|
`delete_time` datetime DEFAULT NULL,
|
|
PRIMARY KEY (`id`),
|
|
KEY `idx_tid_user` (`tid`,`user_id`),
|
|
KEY `idx_tid_platform` (`tid`,`platform`),
|
|
KEY `idx_tid_deleted` (`tid`,`is_deleted`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='租户密码存储';
|
|
|
|
-- 已经按旧的「单账号」结构建过表的库,请执行
|
|
-- sql/alter_password_store_to_multi_accounts.sql 完成升级与数据迁移。
|