大声道撒旦

This commit is contained in:
dengqichen 2025-01-13 15:48:18 +08:00
parent 610fcab26e
commit c705e0eef7
16 changed files with 88 additions and 126 deletions

View File

@ -1,11 +1,9 @@
package com.qqchen.deploy.backend.deploy.dto; package com.qqchen.deploy.backend.deploy.dto;
import com.qqchen.deploy.backend.deploy.entity.ProjectGroup;
import com.qqchen.deploy.backend.deploy.enums.DevelopmentLanguageTypeEnum; import com.qqchen.deploy.backend.deploy.enums.DevelopmentLanguageTypeEnum;
import com.qqchen.deploy.backend.framework.dto.BaseDTO; import com.qqchen.deploy.backend.framework.dto.BaseDTO;
import com.qqchen.deploy.backend.system.model.ExternalSystemDTO; import com.qqchen.deploy.backend.system.model.ExternalSystemDTO;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
@ -29,27 +27,27 @@ public class ApplicationDTO extends BaseDTO {
@NotNull(message = "三方系统ID不能为空") @NotNull(message = "三方系统ID不能为空")
private Long externalSystemId; private Long externalSystemId;
private ExternalSystemDTO externalSystem;
@NotNull(message = "代码仓库组ID不能为空") @NotNull(message = "代码仓库组ID不能为空")
private Long repoGroupId; private Long repoGroupId;
private RepositoryGroupDTO repositoryGroup;
@NotNull(message = "代码仓库项目ID不能为空") @NotNull(message = "代码仓库项目ID不能为空")
private Long repoProjectId; private Long repoProjectId;
private RepositoryProjectDTO repositoryProject;
@NotNull(message = "所属项目组ID不能为空") @NotNull(message = "所属项目组ID不能为空")
private Long projectGroupId; private Long projectGroupId;
private ProjectGroupDTO projectGroup;
@Schema(description = "是否启用") @Schema(description = "是否启用")
private Boolean enabled; private Boolean enabled;
@NotNull(message = "排序号不能为空") @NotNull(message = "排序号不能为空")
private Integer sort; private Integer sort;
private ExternalSystemDTO externalSystem;
private RepositoryGroupDTO repositoryGroup;
private RepositoryProjectDTO repositoryProject;
private ProjectGroupDTO projectGroup;
} }

View File

@ -15,10 +15,6 @@ public class RepositoryBranchDTO extends BaseDTO {
private String name; private String name;
private Long projectId;
private Long externalSystemId;
private Boolean isDefaultBranch; private Boolean isDefaultBranch;
private Boolean isProtected; private Boolean isProtected;
@ -29,13 +25,17 @@ public class RepositoryBranchDTO extends BaseDTO {
private Boolean developersCanMerge; private Boolean developersCanMerge;
private String commitId; private String lastCommitId;
private String commitMessage; private String lastCommitMessage;
private String commitAuthor; private String commitAuthor;
private LocalDateTime commitDate; private LocalDateTime commitDate;
private String webUrl; private String webUrl;
private Long repoProjectId;
private Long externalSystemId;
} }

View File

@ -23,11 +23,6 @@ public class RepositoryGroupDTO extends BaseDTO {
*/ */
private String description; private String description;
/**
* 外部系统中的组ID
*/
private Long groupId;
/** /**
* 父级仓库组ID * 父级仓库组ID
*/ */
@ -38,11 +33,6 @@ public class RepositoryGroupDTO extends BaseDTO {
*/ */
private String path; private String path;
/**
* 外部系统ID
*/
private Long externalSystemId;
/** /**
* 头像URL * 头像URL
*/ */
@ -72,4 +62,15 @@ public class RepositoryGroupDTO extends BaseDTO {
private Boolean enabled; private Boolean enabled;
/**
* 外部系统中的组ID
*/
private Long repoGroupId;
/**
* 外部系统ID
*/
private Long externalSystemId;
} }

View File

@ -21,8 +21,6 @@ public class RepositoryProjectDTO extends BaseDTO {
private String visibility; private String visibility;
private Long groupId;
private String isDefaultBranch; private String isDefaultBranch;
private String webUrl; private String webUrl;
@ -35,5 +33,7 @@ public class RepositoryProjectDTO extends BaseDTO {
private Long externalSystemId; private Long externalSystemId;
private Long projectId; private Long repoGroupId;
private Long repoProjectId;
} }

View File

@ -80,7 +80,7 @@ public class JenkinsBaseBuildVariables {
format = "monaco-editor", // 使用 Monaco Editor format = "monaco-editor", // 使用 Monaco Editor
defaultValue = "#!/bin/bash\n\necho \"Hello World\"", defaultValue = "#!/bin/bash\n\necho \"Hello World\"",
codeEditor = @CodeEditorConfig( codeEditor = @CodeEditorConfig(
language = "shell", language = "groovy",
theme = "vs-dark", theme = "vs-dark",
minimap = false, minimap = false,
lineNumbers = true, lineNumbers = true,

View File

@ -19,7 +19,6 @@ import org.hibernate.annotations.Type;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@jakarta.persistence.Entity @jakarta.persistence.Entity
@Table(name = "deploy_app_config") @Table(name = "deploy_app_config")
@LogicDelete
public class DeployAppConfig extends Entity<Long> { public class DeployAppConfig extends Entity<Long> {

View File

@ -1,24 +0,0 @@
package com.qqchen.deploy.backend.deploy.entity;
import com.qqchen.deploy.backend.framework.domain.Entity;
import jakarta.persistence.Column;
import jakarta.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 项目环境关联实体
*/
@Data
@EqualsAndHashCode(callSuper = true)
@jakarta.persistence.Entity
@Table(name = "deploy_project_group_environment")
public class ProjectGroupEnvironment extends Entity<Long> {
@Column(name = "project_group_id")
private Long projectGroupId;
@Column(name = "environment_id")
private Long environmentId;
}

View File

@ -19,8 +19,8 @@ public class RepositoryBranch extends Entity<Long> {
@Column(nullable = false) @Column(nullable = false)
private String name; private String name;
@Column(name = "commit_id") @Column(name = "last_commit_id")
private String commitId; private String lastCommitId;
@Column(name = "commit_message", columnDefinition = "TEXT") @Column(name = "commit_message", columnDefinition = "TEXT")
private String commitMessage; private String commitMessage;
@ -55,8 +55,8 @@ public class RepositoryBranch extends Entity<Long> {
@Column(name = "project_id", nullable = false) @Column(name = "project_id", nullable = false)
private Long projectId; // 我们数据库的project表的ID private Long projectId; // 我们数据库的project表的ID
@Column(name = "git_project_id", nullable = false) @Column(name = "repo_project_id", nullable = false)
private Long gitProjectId; // GitLab的真实project_id private Long repoProjectId; // GitLab的真实project_id
@Column(name = "external_system_id", nullable = false) @Column(name = "external_system_id", nullable = false)
private Long externalSystemId; private Long externalSystemId;

View File

@ -42,8 +42,8 @@ public class RepositoryGroup extends Entity<Long> {
@Column(name = "external_system_id") @Column(name = "external_system_id")
private Long externalSystemId; private Long externalSystemId;
@Column(name = "group_id", nullable = false) @Column(name = "repo_group_id", nullable = false)
private Long groupId; private Long repoGroupId;
@Column(name = "full_name") @Column(name = "full_name")
private String fullName; private String fullName;

View File

@ -26,9 +26,6 @@ public class RepositoryProject extends Entity<Long> {
private String visibility; private String visibility;
@Column(name = "group_id")
private Long groupId;
@Column(name = "default_branch") @Column(name = "default_branch")
private String defaultBranch; private String defaultBranch;
@ -56,6 +53,10 @@ public class RepositoryProject extends Entity<Long> {
@Column(name = "external_system_id") @Column(name = "external_system_id")
private Long externalSystemId; private Long externalSystemId;
@Column(name = "project_id", nullable = false) @Column(name = "repo_group_id")
private Long projectId; private Long repoGroupId;
}
@Column(name = "repo_project_id", nullable = false)
private Long repoProjectId;
}

View File

@ -1,6 +1,5 @@
package com.qqchen.deploy.backend.deploy.repository; package com.qqchen.deploy.backend.deploy.repository;
import com.qqchen.deploy.backend.deploy.dto.RepositoryProjectDTO;
import com.qqchen.deploy.backend.framework.repository.IBaseRepository; import com.qqchen.deploy.backend.framework.repository.IBaseRepository;
import com.qqchen.deploy.backend.deploy.entity.RepositoryProject; import com.qqchen.deploy.backend.deploy.entity.RepositoryProject;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -17,7 +16,7 @@ public interface IRepositoryProjectRepository extends IBaseRepository<Repository
* @param groupId 仓库组ID * @param groupId 仓库组ID
* @return 项目列表 * @return 项目列表
*/ */
List<RepositoryProject> findByExternalSystemIdAndGroupId(Long externalSystemId, Long groupId); List<RepositoryProject> findByExternalSystemIdAndRepoGroupId(Long externalSystemId, Long groupId);
/** /**
* 统计指定外部系统下的项目数量 * 统计指定外部系统下的项目数量

View File

@ -18,7 +18,6 @@ import com.qqchen.deploy.backend.framework.exception.BusinessException;
import com.qqchen.deploy.backend.framework.service.impl.BaseServiceImpl; import com.qqchen.deploy.backend.framework.service.impl.BaseServiceImpl;
import com.qqchen.deploy.backend.deploy.dto.RepositorySyncHistoryDTO; import com.qqchen.deploy.backend.deploy.dto.RepositorySyncHistoryDTO;
import com.qqchen.deploy.backend.deploy.service.IRepositorySyncHistoryService; import com.qqchen.deploy.backend.deploy.service.IRepositorySyncHistoryService;
import com.qqchen.deploy.backend.deploy.repository.IRepositorySyncHistoryRepository;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.orm.ObjectOptimisticLockingFailureException; import org.springframework.orm.ObjectOptimisticLockingFailureException;
@ -140,10 +139,10 @@ public class RepositoryBranchServiceImpl extends BaseServiceImpl<RepositoryBranc
for (RepositoryProject project : projects) { for (RepositoryProject project : projects) {
CompletableFuture<List<RepositoryBranch>> future = CompletableFuture.supplyAsync(() -> { CompletableFuture<List<RepositoryBranch>> future = CompletableFuture.supplyAsync(() -> {
try { try {
log.info("Syncing branches for project: {} (ID: {}, GitLab ID: {})", project.getName(), project.getId(), project.getProjectId()); log.info("Syncing branches for project: {} (ID: {}, GitLab ID: {})", project.getName(), project.getId(), project.getRepoProjectId());
// 5.1 获取当前项目在GitLab上的所有分支 // 5.1 获取当前项目在GitLab上的所有分支
List<GitBranchResponse> remoteBranches = gitServiceIntegration.branches(externalSystem, project.getProjectId()); List<GitBranchResponse> remoteBranches = gitServiceIntegration.branches(externalSystem, project.getRepoProjectId());
log.info("Found {} remote branches for project: {}", remoteBranches.size(), project.getName()); log.info("Found {} remote branches for project: {}", remoteBranches.size(), project.getName());
List<RepositoryBranch> branchesToUpdate = new ArrayList<>(); List<RepositoryBranch> branchesToUpdate = new ArrayList<>();
@ -157,13 +156,13 @@ public class RepositoryBranchServiceImpl extends BaseServiceImpl<RepositoryBranc
// 检查分支是否有更新 // 检查分支是否有更新
if (isBranchChanged(branch, remoteBranch)) { if (isBranchChanged(branch, remoteBranch)) {
// 更新分支信息 // 更新分支信息
updateBranchInfo(branch, externalSystemId, project.getId(), project.getProjectId(), remoteBranch); updateBranchInfo(branch, externalSystemId, project.getId(), project.getRepoProjectId(), remoteBranch);
branchesToUpdate.add(branch); branchesToUpdate.add(branch);
log.debug("Branch {} has changes, will be updated", remoteBranch.getName()); log.debug("Branch {} has changes, will be updated", remoteBranch.getName());
} else { } else {
log.debug("Branch {} has no changes, skipping update", remoteBranch.getName()); log.debug("Branch {} has no changes, skipping update", remoteBranch.getName());
} }
processedBranches.add(remoteBranch.getName()); processedBranches.add(remoteBranch.getName());
totalSyncedBranches.incrementAndGet(); totalSyncedBranches.incrementAndGet();
} }
@ -173,7 +172,7 @@ public class RepositoryBranchServiceImpl extends BaseServiceImpl<RepositoryBranc
.flatMap(map -> map.values().stream()) .flatMap(map -> map.values().stream())
.filter(b -> b.getProjectId().equals(project.getId())) .filter(b -> b.getProjectId().equals(project.getId()))
.collect(Collectors.toMap(RepositoryBranch::getName, Function.identity())); .collect(Collectors.toMap(RepositoryBranch::getName, Function.identity()));
for (RepositoryBranch branch : projectBranches.values()) { for (RepositoryBranch branch : projectBranches.values()) {
if (!processedBranches.contains(branch.getName())) { if (!processedBranches.contains(branch.getName())) {
branch.setDeleted(true); branch.setDeleted(true);
@ -185,8 +184,7 @@ public class RepositoryBranchServiceImpl extends BaseServiceImpl<RepositoryBranc
log.info("Processed {} branches for project: {}", branchesToUpdate.size(), project.getName()); log.info("Processed {} branches for project: {}", branchesToUpdate.size(), project.getName());
return branchesToUpdate; return branchesToUpdate;
} catch (Exception e) { } catch (Exception e) {
log.error("Failed to sync branches for project: {} (ID: {}, GitLab ID: {})", log.error("Failed to sync branches for project: {} (ID: {}, GitLab ID: {})", project.getName(), project.getId(), project.getRepoProjectId(), e);
project.getName(), project.getId(), project.getProjectId(), e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}, executor); }, executor);
@ -243,19 +241,19 @@ public class RepositoryBranchServiceImpl extends BaseServiceImpl<RepositoryBranc
private String generateCompareKey(Object obj) { private String generateCompareKey(Object obj) {
StringBuilder key = new StringBuilder(); StringBuilder key = new StringBuilder();
if (obj instanceof RepositoryBranch branch) { if (obj instanceof RepositoryBranch branch) {
key.append(branch.getCommitId()) key.append(branch.getLastCommitId())
.append(branch.getIsDefaultBranch()) .append(branch.getIsDefaultBranch())
.append(branch.getCanPush()) .append(branch.getCanPush())
.append(branch.getDevelopersCanPush()) .append(branch.getDevelopersCanPush())
.append(branch.getDevelopersCanMerge()) .append(branch.getDevelopersCanMerge())
.append(branch.getWebUrl()); .append(branch.getWebUrl());
} else if (obj instanceof GitBranchResponse branch) { } else if (obj instanceof GitBranchResponse branch) {
key.append(branch.getCommitId()) key.append(branch.getCommitId())
.append(branch.getIsDefaultBranch()) .append(branch.getIsDefaultBranch())
.append(branch.getCanPush()) .append(branch.getCanPush())
.append(branch.getDevelopersCanPush()) .append(branch.getDevelopersCanPush())
.append(branch.getDevelopersCanMerge()) .append(branch.getDevelopersCanMerge())
.append(branch.getWebUrl()); .append(branch.getWebUrl());
} }
return key.toString(); return key.toString();
} }
@ -263,21 +261,16 @@ public class RepositoryBranchServiceImpl extends BaseServiceImpl<RepositoryBranc
/** /**
* 更新分支信息 * 更新分支信息
*/ */
private void updateBranchInfo( private void updateBranchInfo(RepositoryBranch branch, Long externalSystemId, Long projectId, Long gitProjectId, GitBranchResponse remoteBranch) {
RepositoryBranch branch,
Long externalSystemId,
Long projectId,
Long gitProjectId,
GitBranchResponse remoteBranch) {
branch.setExternalSystemId(externalSystemId); branch.setExternalSystemId(externalSystemId);
branch.setProjectId(projectId); branch.setProjectId(projectId);
branch.setGitProjectId(gitProjectId); branch.setRepoProjectId(gitProjectId);
branch.setName(remoteBranch.getName()); branch.setName(remoteBranch.getName());
branch.setIsDefaultBranch(remoteBranch.getIsDefaultBranch()); branch.setIsDefaultBranch(remoteBranch.getIsDefaultBranch());
branch.setCanPush(remoteBranch.getCanPush()); branch.setCanPush(remoteBranch.getCanPush());
branch.setDevelopersCanPush(remoteBranch.getDevelopersCanPush()); branch.setDevelopersCanPush(remoteBranch.getDevelopersCanPush());
branch.setDevelopersCanMerge(remoteBranch.getDevelopersCanMerge()); branch.setDevelopersCanMerge(remoteBranch.getDevelopersCanMerge());
branch.setCommitId(remoteBranch.getCommitId()); branch.setLastCommitId(remoteBranch.getCommitId());
branch.setCommitMessage(remoteBranch.getCommitMessage()); branch.setCommitMessage(remoteBranch.getCommitMessage());
branch.setCommitAuthor(remoteBranch.getCommitAuthor()); branch.setCommitAuthor(remoteBranch.getCommitAuthor());
branch.setCommitDate(remoteBranch.getCommitDate()); branch.setCommitDate(remoteBranch.getCommitDate());

View File

@ -62,7 +62,7 @@ public class RepositoryGroupServiceImpl extends BaseServiceImpl<RepositoryGroup,
// 3. 获取本地已存在的仓库组 // 3. 获取本地已存在的仓库组
List<RepositoryGroup> existingGroups = repositoryGroupRepository.findByExternalSystemIdAndDeletedFalse(externalSystemId); List<RepositoryGroup> existingGroups = repositoryGroupRepository.findByExternalSystemIdAndDeletedFalse(externalSystemId);
Map<Long, RepositoryGroup> existingGroupMap = existingGroups.stream() Map<Long, RepositoryGroup> existingGroupMap = existingGroups.stream()
.collect(Collectors.toMap(RepositoryGroup::getGroupId, Function.identity())); .collect(Collectors.toMap(RepositoryGroup::getRepoGroupId, Function.identity()));
// 4. 处理每个远程仓库组 // 4. 处理每个远程仓库组
List<RepositoryGroup> groupsToSave = new ArrayList<>(); List<RepositoryGroup> groupsToSave = new ArrayList<>();
@ -71,7 +71,7 @@ public class RepositoryGroupServiceImpl extends BaseServiceImpl<RepositoryGroup,
// 更新基本信息 // 更新基本信息
group.setExternalSystemId(externalSystemId); group.setExternalSystemId(externalSystemId);
group.setGroupId(remoteGroup.getId()); group.setRepoGroupId(remoteGroup.getId());
group.setName(remoteGroup.getName()); group.setName(remoteGroup.getName());
group.setPath(remoteGroup.getPath()); group.setPath(remoteGroup.getPath());
group.setDescription(remoteGroup.getDescription()); group.setDescription(remoteGroup.getDescription());

View File

@ -113,11 +113,10 @@ public class RepositoryProjectServiceImpl extends BaseServiceImpl<RepositoryProj
.findByExternalSystemId(externalSystemId) .findByExternalSystemId(externalSystemId)
.stream() .stream()
.collect(Collectors.toMap( .collect(Collectors.toMap(
RepositoryProject::getProjectId, RepositoryProject::getRepoProjectId,
Function.identity(), Function.identity(),
(existing, replacement) -> { (existing, replacement) -> {
log.warn("Duplicate project found with ID: {}, path: {}", log.warn("Duplicate project found with ID: {}, path: {}", existing.getRepoProjectId(), existing.getPathWithNamespace());
existing.getProjectId(), existing.getPathWithNamespace());
return existing; return existing;
} }
)) ))
@ -135,14 +134,12 @@ public class RepositoryProjectServiceImpl extends BaseServiceImpl<RepositoryProj
for (RepositoryGroup group : groups) { for (RepositoryGroup group : groups) {
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> { CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
try { try {
List<GitProjectResponse> projectResponses = gitServiceIntegration.projectsByGroup(externalSystem, group.getGroupId()); List<GitProjectResponse> projectResponses = gitServiceIntegration.projectsByGroup(externalSystem, group.getRepoGroupId());
log.info("Processing group: {} (ID: {}), found {} projects", log.info("Processing group: {} (ID: {}), found {} projects", group.getName(), group.getRepoGroupId(), projectResponses.size());
group.getName(), group.getGroupId(), projectResponses.size());
for (GitProjectResponse projectResponse : projectResponses) { for (GitProjectResponse projectResponse : projectResponses) {
if (!processedProjectIds.add(projectResponse.getId())) { if (!processedProjectIds.add(projectResponse.getId())) {
log.info("Project already processed: {} (ID: {}) in group: {}", log.info("Project already processed: {} (ID: {}) in group: {}", projectResponse.getPathWithNamespace(), projectResponse.getId(), group.getName());
projectResponse.getPathWithNamespace(), projectResponse.getId(), group.getName());
continue; continue;
} }
@ -150,7 +147,7 @@ public class RepositoryProjectServiceImpl extends BaseServiceImpl<RepositoryProj
if (project == null) { if (project == null) {
project = new RepositoryProject(); project = new RepositoryProject();
project.setExternalSystemId(externalSystemId); project.setExternalSystemId(externalSystemId);
project.setProjectId(projectResponse.getId()); project.setRepoProjectId(projectResponse.getId());
log.info("Creating new project: {} (ID: {})", log.info("Creating new project: {} (ID: {})",
projectResponse.getPathWithNamespace(), projectResponse.getId()); projectResponse.getPathWithNamespace(), projectResponse.getId());
totalCount.incrementAndGet(); totalCount.incrementAndGet();
@ -164,7 +161,7 @@ public class RepositoryProjectServiceImpl extends BaseServiceImpl<RepositoryProj
project.setPath(projectResponse.getPath()); project.setPath(projectResponse.getPath());
project.setDescription(projectResponse.getDescription()); project.setDescription(projectResponse.getDescription());
project.setVisibility(projectResponse.getVisibility()); project.setVisibility(projectResponse.getVisibility());
project.setGroupId(group.getId()); project.setRepoGroupId(group.getRepoGroupId());
project.setDefaultBranch(projectResponse.getDefaultBranch()); project.setDefaultBranch(projectResponse.getDefaultBranch());
project.setWebUrl(projectResponse.getWebUrl()); project.setWebUrl(projectResponse.getWebUrl());
project.setSshUrl(projectResponse.getSshUrlToRepo()); project.setSshUrl(projectResponse.getSshUrlToRepo());

View File

@ -44,7 +44,7 @@ public class DeployNodeLocalVariables extends BaseNodeLocalVariables {
format = "monaco-editor", // 使用 Monaco Editor format = "monaco-editor", // 使用 Monaco Editor
defaultValue = "#!/bin/bash\n\necho \"Hello World\"", defaultValue = "#!/bin/bash\n\necho \"Hello World\"",
codeEditor = @CodeEditorConfig( codeEditor = @CodeEditorConfig(
language = "shell", language = "groovy",
theme = "vs-dark", theme = "vs-dark",
minimap = false, minimap = false,
lineNumbers = true, lineNumbers = true,

View File

@ -282,7 +282,6 @@ CREATE TABLE deploy_repo_group
-- 基础字段 -- 基础字段
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '主键ID', id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '主键ID',
-- 业务字段 -- 业务字段
group_id BIGINT NOT NULL COMMENT 'Git系统中的组ID',
name VARCHAR(100) NOT NULL COMMENT '仓库组名', name VARCHAR(100) NOT NULL COMMENT '仓库组名',
description VARCHAR(500) NULL COMMENT '仓库组描述', description VARCHAR(500) NULL COMMENT '仓库组描述',
parent_id BIGINT NULL COMMENT '父级仓库组ID', parent_id BIGINT NULL COMMENT '父级仓库组ID',
@ -294,6 +293,7 @@ CREATE TABLE deploy_repo_group
web_url VARCHAR(255) NULL COMMENT '网页URL', web_url VARCHAR(255) NULL COMMENT '网页URL',
visibility ENUM('private', 'internal', 'public') NOT NULL DEFAULT 'private' COMMENT '可见性private-私有internal-内部public-公开', visibility ENUM('private', 'internal', 'public') NOT NULL DEFAULT 'private' COMMENT '可见性private-私有internal-内部public-公开',
sort INT DEFAULT 0 COMMENT '排序号', sort INT DEFAULT 0 COMMENT '排序号',
repo_group_id BIGINT NOT NULL COMMENT 'Git系统中的组ID',
create_by VARCHAR(100) NULL COMMENT '创建人', create_by VARCHAR(100) NULL COMMENT '创建人',
create_time DATETIME(6) NULL COMMENT '创建时间', create_time DATETIME(6) NULL COMMENT '创建时间',
@ -308,18 +308,11 @@ CREATE TABLE deploy_repo_group
CREATE TABLE deploy_repo_project CREATE TABLE deploy_repo_project
( (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '主键ID', id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '主键ID',
create_by VARCHAR(255) NULL COMMENT '创建人',
create_time DATETIME(6) NULL COMMENT '创建时间',
deleted BIT NOT NULL DEFAULT 0 COMMENT '是否删除0未删除1已删除',
update_by VARCHAR(255) NULL COMMENT '更新人',
update_time DATETIME(6) NULL COMMENT '更新时间',
version INT NOT NULL DEFAULT 0 COMMENT '乐观锁版本号',
name VARCHAR(255) NOT NULL COMMENT '项目名称', name VARCHAR(255) NOT NULL COMMENT '项目名称',
path VARCHAR(255) NOT NULL COMMENT '项目路径', path VARCHAR(255) NOT NULL COMMENT '项目路径',
description TEXT NULL COMMENT '项目描述', description TEXT NULL COMMENT '项目描述',
visibility VARCHAR(50) NULL COMMENT '可见性', visibility VARCHAR(50) NULL COMMENT '可见性',
group_id BIGINT NULL COMMENT '所属组ID',
default_branch VARCHAR(100) NULL COMMENT '默认分支', default_branch VARCHAR(100) NULL COMMENT '默认分支',
web_url VARCHAR(500) NULL COMMENT 'Web URL', web_url VARCHAR(500) NULL COMMENT 'Web URL',
ssh_url VARCHAR(500) NULL COMMENT 'SSH URL', ssh_url VARCHAR(500) NULL COMMENT 'SSH URL',
@ -328,11 +321,18 @@ CREATE TABLE deploy_repo_project
name_with_namespace VARCHAR(500) NULL COMMENT '带命名空间的名称', name_with_namespace VARCHAR(500) NULL COMMENT '带命名空间的名称',
path_with_namespace VARCHAR(500) NULL COMMENT '带命名空间的路径', path_with_namespace VARCHAR(500) NULL COMMENT '带命名空间的路径',
created_at DATETIME(6) NULL COMMENT '创建时间', created_at DATETIME(6) NULL COMMENT '创建时间',
external_system_id BIGINT NOT NULL COMMENT '外部系统ID',
project_id BIGINT NOT NULL COMMENT '项目ID',
CONSTRAINT UK_repo_project_external_system_id_project_id UNIQUE (external_system_id, project_id), external_system_id BIGINT NOT NULL COMMENT '外部系统ID',
CONSTRAINT FK_repo_project_group FOREIGN KEY (group_id) REFERENCES deploy_repo_group (id), repo_group_id BIGINT NOT NULL COMMENT '项目ID',
repo_project_id BIGINT NOT NULL COMMENT '项目ID',
create_by VARCHAR(255) NULL COMMENT '创建人',
create_time DATETIME(6) NULL COMMENT '创建时间',
deleted BIT NOT NULL DEFAULT 0 COMMENT '是否删除0未删除1已删除',
update_by VARCHAR(255) NULL COMMENT '更新人',
update_time DATETIME(6) NULL COMMENT '更新时间',
version INT NOT NULL DEFAULT 0 COMMENT '乐观锁版本号',
CONSTRAINT FK_repo_project_external_system FOREIGN KEY (external_system_id) REFERENCES sys_external_system (id) CONSTRAINT FK_repo_project_external_system FOREIGN KEY (external_system_id) REFERENCES sys_external_system (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Git仓库项目表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Git仓库项目表';
@ -347,7 +347,7 @@ CREATE TABLE deploy_repo_branch
can_push BIT DEFAULT 1 COMMENT '是否可推送0-否1-是', can_push BIT DEFAULT 1 COMMENT '是否可推送0-否1-是',
developers_can_push BIT DEFAULT 1 COMMENT '开发者是否可推送0-否1-是', developers_can_push BIT DEFAULT 1 COMMENT '开发者是否可推送0-否1-是',
developers_can_merge BIT DEFAULT 1 COMMENT '开发者是否可合并0-否1-是', developers_can_merge BIT DEFAULT 1 COMMENT '开发者是否可合并0-否1-是',
commit_id VARCHAR(64) NULL COMMENT '最新提交ID', last_commit_id VARCHAR(64) NULL COMMENT '最新提交ID',
commit_message TEXT NULL COMMENT '最新提交信息', commit_message TEXT NULL COMMENT '最新提交信息',
commit_author VARCHAR(100) NULL COMMENT '最新提交作者', commit_author VARCHAR(100) NULL COMMENT '最新提交作者',
commit_date DATETIME(6) NULL COMMENT '最新提交时间', commit_date DATETIME(6) NULL COMMENT '最新提交时间',
@ -356,7 +356,7 @@ CREATE TABLE deploy_repo_branch
web_url VARCHAR(255) NULL COMMENT '网页URL', web_url VARCHAR(255) NULL COMMENT '网页URL',
project_id BIGINT NOT NULL COMMENT '所属项目ID', project_id BIGINT NOT NULL COMMENT '所属项目ID',
external_system_id BIGINT NOT NULL COMMENT '外部系统ID', external_system_id BIGINT NOT NULL COMMENT '外部系统ID',
git_project_id BIGINT NOT NULL COMMENT 'GitLab的真实project_id', repo_project_id BIGINT NOT NULL COMMENT 'GitLab的真实project_id',
create_by VARCHAR(100) NULL COMMENT '创建人', create_by VARCHAR(100) NULL COMMENT '创建人',
create_time DATETIME(6) NULL COMMENT '创建时间', create_time DATETIME(6) NULL COMMENT '创建时间',
@ -365,9 +365,7 @@ CREATE TABLE deploy_repo_branch
version INT NOT NULL DEFAULT 1 COMMENT '版本号', version INT NOT NULL DEFAULT 1 COMMENT '版本号',
deleted BIT NOT NULL DEFAULT 0 COMMENT '是否删除0-未删除1-已删除' deleted BIT NOT NULL DEFAULT 0 COMMENT '是否删除0-未删除1-已删除'
) ENGINE = InnoDB ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT ='代码仓库分支表';
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT ='代码仓库分支表';
-- -------------------------------------------------------------------------------------- -- --------------------------------------------------------------------------------------
-- 工作流相关表 -- 工作流相关表