1. 新增在线协同文档功能 v 1
This commit is contained in:
75
sql/mysql/doc_management.sql
Normal file
75
sql/mysql/doc_management.sql
Normal file
@@ -0,0 +1,75 @@
|
||||
-- 在线文档管理功能相关表结构
|
||||
|
||||
-- 在线文档表
|
||||
CREATE TABLE `infra_doc_file` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '文档编号',
|
||||
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文档标题',
|
||||
`file_id` bigint DEFAULT NULL COMMENT '文件编号',
|
||||
`file_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件类型(docx/xlsx/pptx)',
|
||||
`space_type` tinyint NOT NULL DEFAULT '1' COMMENT '空间类型(1-个人空间 2-团队空间)',
|
||||
`description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '文档描述',
|
||||
`latest_version_id` bigint DEFAULT NULL COMMENT '最新版本编号',
|
||||
`owner_user_id` bigint NOT NULL COMMENT '所有者用户编号',
|
||||
`status` tinyint NOT NULL DEFAULT '1' COMMENT '状态(0-禁用 1-启用)',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `idx_owner_user_id` (`owner_user_id`) USING BTREE,
|
||||
KEY `idx_space_type` (`space_type`) USING BTREE,
|
||||
KEY `idx_file_type` (`file_type`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='在线文档表';
|
||||
|
||||
-- 文档版本表
|
||||
CREATE TABLE `infra_doc_file_version` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '版本编号',
|
||||
`doc_file_id` bigint NOT NULL COMMENT '文档编号',
|
||||
`version_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '版本号',
|
||||
`file_id` bigint NOT NULL COMMENT '文件编号',
|
||||
`change_description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '变更说明',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `idx_doc_file_id` (`doc_file_id`) USING BTREE,
|
||||
KEY `idx_version_no` (`version_no`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文档版本表';
|
||||
|
||||
-- 文档权限表
|
||||
CREATE TABLE `infra_doc_file_permission` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '权限编号',
|
||||
`doc_file_id` bigint NOT NULL COMMENT '文档编号',
|
||||
`role_id` bigint NOT NULL COMMENT '角色编号',
|
||||
`permission_type` tinyint NOT NULL DEFAULT '1' COMMENT '权限类型(1-只读 2-编辑 3-管理)',
|
||||
`expire_time` datetime DEFAULT NULL COMMENT '过期时间',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_doc_role` (`doc_file_id`,`role_id`,`deleted`) USING BTREE,
|
||||
KEY `idx_role_id` (`role_id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文档权限表';
|
||||
|
||||
-- 文档编辑历史表
|
||||
CREATE TABLE `infra_doc_edit_history` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '历史编号',
|
||||
`doc_file_id` bigint NOT NULL COMMENT '文档编号',
|
||||
`user_id` bigint NOT NULL COMMENT '编辑用户编号',
|
||||
`user_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '编辑用户名称',
|
||||
`edit_type` tinyint NOT NULL DEFAULT '1' COMMENT '编辑类型(1-创建 2-编辑 3-删除 4-重命名)',
|
||||
`description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '操作描述',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `idx_doc_file_id` (`doc_file_id`) USING BTREE,
|
||||
KEY `idx_user_id` (`user_id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文档编辑历史表';
|
||||
Reference in New Issue
Block a user