build: v2.5 flyway init

This commit is contained in:
CaptainB 2022-12-14 15:53:18 +08:00 committed by 刘瑞斌
parent f1744c6fa1
commit 80cb253aa4

View File

@ -0,0 +1,110 @@
-- v2_5_modify_workspace_name_length
-- 创建人 liyuhao
-- 创建时间 2022-11-29 13:19:51
ALTER TABLE workspace
MODIFY name varchar(100) NOT NULL COMMENT 'Workspace name';
-- v2_5_init_super_group_permission
-- 创建人 liyuhao
-- 创建时间 2022-12-05 14:38:10
DROP PROCEDURE IF EXISTS init_super_permission;
DELIMITER //
CREATE PROCEDURE init_super_permission()
BEGIN
SET @permission_str = 'SYSTEM_USER:READ, SYSTEM_USER:READ+CREATE, SYSTEM_USER:READ+IMPORT, SYSTEM_USER:READ+EDIT,
SYSTEM_USER:READ+DELETE, SYSTEM_USER:READ+EDIT_PASSWORD, SYSTEM_WORKSPACE:READ, SYSTEM_WORKSPACE:READ+CREATE,
SYSTEM_WORKSPACE:READ+EDIT, SYSTEM_WORKSPACE:READ+DELETE, SYSTEM_GROUP:READ, SYSTEM_GROUP:READ+CREATE,
SYSTEM_GROUP:READ+EDIT, SYSTEM_GROUP:READ+SETTING_PERMISSION, SYSTEM_GROUP:READ+DELETE, SYSTEM_TEST_POOL:READ,
SYSTEM_TEST_POOL:READ+CREATE, SYSTEM_TEST_POOL:READ+EDIT, SYSTEM_TEST_POOL:READ+DELETE,
SYSTEM_SETTING:READ, SYSTEM_SETTING:READ+EDIT, SYSTEM_QUOTA:READ, SYSTEM_QUOTA:READ+EDIT,
SYSTEM_AUTH:READ, SYSTEM_AUTH:READ+EDIT, SYSTEM_OPERATING_LOG:READ, WORKSPACE_SERVICE:READ,
WORKSPACE_SERVICE:READ+EDIT, WORKSPACE_USER:READ, WORKSPACE_USER:READ+CREATE, WORKSPACE_USER:READ+EDIT,
WORKSPACE_USER:READ+DELETE, WORKSPACE_PROJECT_MANAGER:READ, WORKSPACE_PROJECT_MANAGER:READ+CREATE,
WORKSPACE_PROJECT_MANAGER:READ+EDIT, WORKSPACE_PROJECT_MANAGER:READ+DELETE,
WORKSPACE_PROJECT_MANAGER:READ+ENVIRONMENT_CONFIG, WORKSPACE_PROJECT_MANAGER:READ+ADD_USER,
WORKSPACE_PROJECT_MANAGER:READ+EDIT_USER, WORKSPACE_PROJECT_MANAGER:READ+DELETE_USER,
WORKSPACE_PROJECT_ENVIRONMENT:READ, WORKSPACE_PROJECT_ENVIRONMENT:READ+CREATE,
WORKSPACE_PROJECT_ENVIRONMENT:READ+EDIT, WORKSPACE_PROJECT_ENVIRONMENT:READ+DELETE,
WORKSPACE_PROJECT_ENVIRONMENT:READ+COPY, WORKSPACE_PROJECT_ENVIRONMENT:READ+IMPORT,
WORKSPACE_PROJECT_ENVIRONMENT:READ+EXPORT, WORKSPACE_PROJECT_ENVIRONMENT:READ+CREATE_GROUP,
WORKSPACE_PROJECT_ENVIRONMENT:READ+EDIT_GROUP, WORKSPACE_PROJECT_ENVIRONMENT:READ+COPY_GROUP,
WORKSPACE_PROJECT_ENVIRONMENT:READ+DELETE_GROUP, WORKSPACE_QUOTA:READ, WORKSPACE_QUOTA:READ+EDIT,
WORKSPACE_OPERATING_LOG:READ, SYSTEM_PLUGIN:UPLOAD, SYSTEM_PLUGIN:DEL, SYSTEM_PLUGIN:READ,
PERSONAL_INFORMATION:READ+EDIT, PERSONAL_INFORMATION:READ+API_KEYS, PERSONAL_INFORMATION:READ+EDIT_PASSWORD,
PERSONAL_INFORMATION:READ+THIRD_ACCOUNT, PERSONAL_INFORMATION:READ+UI_SETTING,
PROJECT_USER:READ, PROJECT_USER:READ+CREATE, PROJECT_USER:READ+EDIT, PROJECT_USER:READ+DELETE,
PROJECT_GROUP:READ, PROJECT_GROUP:READ+CREATE, PROJECT_GROUP:READ+EDIT, PROJECT_GROUP:READ+DELETE,
PROJECT_GROUP:READ+SETTING_PERMISSION, PROJECT_MANAGER:READ, PROJECT_MANAGER:READ+EDIT,
PROJECT_APP_MANAGER:READ+EDIT, PROJECT_ENVIRONMENT:READ, PROJECT_ENVIRONMENT:READ+CREATE,
PROJECT_ENVIRONMENT:READ+EDIT, PROJECT_ENVIRONMENT:READ+DELETE, PROJECT_ENVIRONMENT:READ+COPY,
PROJECT_ENVIRONMENT:READ+IMPORT, PROJECT_ENVIRONMENT:READ+EXPORT, PROJECT_OPERATING_LOG:READ,
PROJECT_FILE:READ, PROJECT_FILE:READ+UPLOAD+JAR, PROJECT_FILE:READ+DOWNLOAD+JAR, PROJECT_FILE:READ+DELETE+JAR,
PROJECT_FILE:READ+BATCH+DELETE, PROJECT_FILE:READ+BATCH+DOWNLOAD, PROJECT_FILE:READ+BATCH+MOVE,
PROJECT_TEMPLATE:READ, PROJECT_TEMPLATE:READ+CASE_TEMPLATE, PROJECT_TEMPLATE:READ+ISSUE_TEMPLATE,
PROJECT_TEMPLATE:READ+API_TEMPLATE, PROJECT_TEMPLATE:READ+CUSTOM, PROJECT_MESSAGE:READ, PROJECT_MESSAGE:READ+EDIT,
PROJECT_MESSAGE:READ+DELETE, PROJECT_CUSTOM_CODE:READ, PROJECT_CUSTOM_CODE:READ+CREATE, PROJECT_CUSTOM_CODE:READ+EDIT,
PROJECT_CUSTOM_CODE:READ+DELETE, PROJECT_CUSTOM_CODE:READ+COPY, PROJECT_VERSION:READ, PROJECT_VERSION:READ+CREATE,
PROJECT_VERSION:READ+EDIT, PROJECT_VERSION:READ+DELETE, PROJECT_VERSION:READ+ENABLE, PROJECT_ERROR_REPORT_LIBRARY:READ,
PROJECT_ERROR_REPORT_LIBRARY:READ+CREATE, PROJECT_ERROR_REPORT_LIBRARY:READ+EDIT, PROJECT_ERROR_REPORT_LIBRARY:READ+DELETE,
PROJECT_ERROR_REPORT_LIBRARY:READ+BATCH_DELETE, PROJECT_TRACK_HOME:READ, PROJECT_TRACK_CASE:READ,
PROJECT_TRACK_CASE:READ+CREATE, PROJECT_TRACK_CASE:READ+EDIT, PROJECT_TRACK_CASE:READ+DELETE, PROJECT_TRACK_CASE:READ+COPY,
PROJECT_TRACK_CASE:READ+IMPORT, PROJECT_TRACK_CASE:READ+EXPORT, PROJECT_TRACK_CASE:READ+RECOVER,
PROJECT_TRACK_CASE:READ+BATCH_EDIT, PROJECT_TRACK_CASE:READ+BATCH_MOVE, PROJECT_TRACK_CASE:READ+BATCH_COPY,
PROJECT_TRACK_CASE:READ+BATCH_DELETE, PROJECT_TRACK_CASE:READ+BATCH_REDUCTION, PROJECT_TRACK_CASE:READ+BATCH_LINK_DEMAND,
PROJECT_TRACK_CASE:READ+GENERATE_DEPENDENCIES, PROJECT_TRACK_CASE:READ+BATCH_ADD_PUBLIC, PROJECT_TRACK_REVIEW:READ,
PROJECT_TRACK_REVIEW:READ+CREATE, PROJECT_TRACK_REVIEW:READ+EDIT, PROJECT_TRACK_REVIEW:READ+DELETE,
PROJECT_TRACK_REVIEW:READ+REVIEW, PROJECT_TRACK_REVIEW:READ+COMMENT, PROJECT_TRACK_REVIEW:READ+RELEVANCE_OR_CANCEL,
PROJECT_TRACK_PLAN:READ, PROJECT_TRACK_PLAN:READ+CREATE, PROJECT_TRACK_PLAN:READ+EDIT, PROJECT_TRACK_PLAN:READ+DELETE,
PROJECT_TRACK_PLAN:READ+COPY, PROJECT_TRACK_PLAN:READ+RUN, PROJECT_TRACK_PLAN:READ+CASE_BATCH_RUN,
PROJECT_TRACK_PLAN:READ+CASE_BATCH_EDIT, PROJECT_TRACK_PLAN:READ+BATCH_DELETE, PROJECT_TRACK_PLAN:READ+SCHEDULE,
PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL, PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE, PROJECT_TRACK_ISSUE:READ,
PROJECT_TRACK_ISSUE:READ+CREATE, PROJECT_TRACK_ISSUE:READ+EDIT, PROJECT_TRACK_ISSUE:READ+DELETE, PROJECT_TRACK_REPORT:READ,
PROJECT_TRACK_REPORT:READ+DELETE, PROJECT_TRACK_REPORT:READ+EXPORT, PROJECT_API_HOME:READ, PROJECT_API_DEFINITION:READ,
PROJECT_API_DEFINITION:READ+CREATE_API, PROJECT_API_DEFINITION:READ+EDIT_API, PROJECT_API_DEFINITION:READ+DELETE_API,
PROJECT_API_DEFINITION:READ+COPY_API, PROJECT_API_DEFINITION:READ+CREATE_CASE, PROJECT_API_DEFINITION:READ+EDIT_CASE,
PROJECT_API_DEFINITION:READ+DELETE_CASE, PROJECT_API_DEFINITION:READ+COPY_CASE, PROJECT_API_DEFINITION:READ+IMPORT_API,
PROJECT_API_DEFINITION:READ+EXPORT_API, PROJECT_API_DEFINITION:READ+TIMING_SYNC, PROJECT_API_DEFINITION:READ+CREATE_PERFORMANCE,
PROJECT_API_DEFINITION:READ+RUN, PROJECT_API_DEFINITION:READ+DEBUG, PROJECT_API_DEFINITION:READ+MOCK, PROJECT_API_SCENARIO:READ,
PROJECT_API_SCENARIO:READ+CREATE, PROJECT_API_SCENARIO:READ+EDIT, PROJECT_API_SCENARIO:READ+DELETE, PROJECT_API_SCENARIO:READ+COPY,
PROJECT_API_SCENARIO:READ+RUN, PROJECT_API_SCENARIO:READ+DEBUG, PROJECT_API_SCENARIO:READ+SCHEDULE, PROJECT_API_SCENARIO:READ+IMPORT_SCENARIO,
PROJECT_API_SCENARIO:READ+EXPORT_SCENARIO, PROJECT_API_SCENARIO:READ+MOVE_BATCH, PROJECT_API_SCENARIO:READ+CREATE_PERFORMANCE,
PROJECT_API_SCENARIO:READ+CREATE_PERFORMANCE_BATCH, PROJECT_API_SCENARIO:READ+BATCH_COPY, PROJECT_API_REPORT:READ,
PROJECT_API_REPORT:READ+DELETE, PROJECT_API_REPORT:READ+EXPORT, PROJECT_UI_ELEMENT:READ, PROJECT_UI_ELEMENT:READ+CREATE,
PROJECT_UI_ELEMENT:READ+EDIT, PROJECT_UI_ELEMENT:READ+DELETE, PROJECT_UI_ELEMENT:READ+COPY, PROJECT_UI_SCENARIO:READ,
PROJECT_UI_SCENARIO:READ+CREATE, PROJECT_UI_SCENARIO:READ+EDIT, PROJECT_UI_SCENARIO:READ+DELETE, PROJECT_UI_SCENARIO:READ+COPY,
PROJECT_UI_SCENARIO:READ+RUN, PROJECT_UI_SCENARIO:READ+DEBUG, PROJECT_UI_SCENARIO:READ+IMPORT_SCENARIO,
PROJECT_UI_SCENARIO:READ+EXPORT_SCENARIO, PROJECT_UI_SCENARIO:READ+MOVE_BATCH, PROJECT_UI_SCENARIO:READ+BATCH_COPY, PROJECT_UI_REPORT:READ,
PROJECT_UI_REPORT:READ+DELETE, PROJECT_PERFORMANCE_HOME:READ, PROJECT_PERFORMANCE_TEST:READ, PROJECT_PERFORMANCE_TEST:READ+CREATE,
PROJECT_PERFORMANCE_TEST:READ+EDIT, PROJECT_PERFORMANCE_TEST:READ+DELETE, PROJECT_PERFORMANCE_TEST:READ+COPY,
PROJECT_PERFORMANCE_TEST:READ+RUN, PROJECT_PERFORMANCE_TEST:READ+SCHEDULE, PROJECT_PERFORMANCE_REPORT:READ,
PROJECT_PERFORMANCE_REPORT:READ+DELETE, PROJECT_PERFORMANCE_REPORT:READ+EXPORT, PROJECT_PERFORMANCE_REPORT:READ+COMPARE,
PROJECT_REPORT_ANALYSIS:READ, PROJECT_REPORT_ANALYSIS:READ+EXPORT, PROJECT_REPORT_ANALYSIS:READ+UPDATE,
PROJECT_REPORT_ANALYSIS:READ+CREATE, PROJECT_ENTERPRISE_REPORT:READ+EXPORT, PROJECT_ENTERPRISE_REPORT:READ+CREATE,
PROJECT_ENTERPRISE_REPORT:READ+DELETE,PROJECT_ENTERPRISE_REPORT:READ+COPY,
PROJECT_ENTERPRISE_REPORT:READ+SCHEDULE, PROJECT_ENTERPRISE_REPORT:READ+EDIT';
SET @i = 1;
SET @count = CHAR_LENGTH(@permission_str) - CHAR_LENGTH(REPLACE(@permission_str, ',', '')) + 1;
WHILE @i <= @count
DO
SET @original_str = SUBSTRING_INDEX(SUBSTRING_INDEX(@permission_str, ',', @i), ',', -1);
SET @permission = TRIM(REPLACE(@original_str, CHAR(10), ''));
SET @module = SUBSTRING_INDEX(@permission, ':', 1);
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
VALUES (UUID(), 'super_group', @permission, @module);
SET @i = @i + 1;
END WHILE;
END
//
DELIMITER ;
CALL init_super_permission();
DROP PROCEDURE IF EXISTS init_super_permission;
-- v2_5_insert_super_group
-- 创建人 liyuhao
INSERT INTO `group` (id, name, description, `system`, type, create_time, update_time, creator, scope_id)
VALUES ('super_group', '超级管理员(系统)', '拥有系统全部工作空间以及项目的操作权限', 1, 'SYSTEM', UNIX_TIMESTAMP() * 1000,
UNIX_TIMESTAMP() * 1000, 'system', 'system');