This is an automated email from the ASF dual-hosted git repository.

lynwee pushed a commit to branch dev-9
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit b0fbdd2f9f8ac83fb560abc173c78d3ee780be6f
Author: d4x1 <[email protected]>
AuthorDate: Fri Sep 6 15:05:53 2024 +0800

    feat(gitlab): add is_child to pipelines
---
 .../20240906_add_is_child_to_pipelines.go          | 60 ++++++++++++++++++++++
 .../gitlab/models/migrationscripts/register.go     |  1 +
 backend/plugins/gitlab/models/pipeline.go          |  3 ++
 3 files changed, 64 insertions(+)

diff --git 
a/backend/plugins/gitlab/models/migrationscripts/20240906_add_is_child_to_pipelines.go
 
b/backend/plugins/gitlab/models/migrationscripts/20240906_add_is_child_to_pipelines.go
new file mode 100644
index 000000000..e904667a2
--- /dev/null
+++ 
b/backend/plugins/gitlab/models/migrationscripts/20240906_add_is_child_to_pipelines.go
@@ -0,0 +1,60 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+       "github.com/apache/incubator-devlake/core/context"
+       "github.com/apache/incubator-devlake/core/errors"
+)
+
+type gitlabPipelineProject240906 struct {
+       IsChild bool
+}
+
+func (gitlabPipelineProject240906) TableName() string {
+       return "_tool_gitlab_pipeline_projects"
+}
+
+type gitlabPipeline240906 struct {
+       IsChild bool
+}
+
+func (gitlabPipeline240906) TableName() string {
+       return "_tool_gitlab_pipelines"
+}
+
+type addIsChildToPipelines240906 struct{}
+
+func (*addIsChildToPipelines240906) Up(baseRes context.BasicRes) errors.Error {
+       db := baseRes.GetDal()
+       if err := db.AutoMigrate(&gitlabPipeline240906{}); err != nil {
+               return err
+       }
+       if err := db.AutoMigrate(&gitlabPipelineProject240906{}); err != nil {
+               return err
+       }
+       return nil
+}
+
+func (*addIsChildToPipelines240906) Version() uint64 {
+       return 20240531110339
+}
+
+func (*addIsChildToPipelines240906) Name() string {
+       return "add is_child to table _tool_gitlab_pipelines and 
_tool_gitlab_pipeline_projects"
+}
diff --git a/backend/plugins/gitlab/models/migrationscripts/register.go 
b/backend/plugins/gitlab/models/migrationscripts/register.go
index 8fda16c47..1d89b2505 100644
--- a/backend/plugins/gitlab/models/migrationscripts/register.go
+++ b/backend/plugins/gitlab/models/migrationscripts/register.go
@@ -51,5 +51,6 @@ func All() []plugin.MigrationScript {
                new(addGitlabAssignee),
                new(addGitlabAssigneeAndReviewerPrimaryKey),
                new(changeIssueComponentType),
+               new(addIsChildToPipelines240906),
        }
 }
diff --git a/backend/plugins/gitlab/models/pipeline.go 
b/backend/plugins/gitlab/models/pipeline.go
index a023b9912..d00a558e7 100644
--- a/backend/plugins/gitlab/models/pipeline.go
+++ b/backend/plugins/gitlab/models/pipeline.go
@@ -45,6 +45,7 @@ type GitlabPipeline struct {
        Environment string `gorm:"type:varchar(255)"`
 
        IsDetailRequired bool
+       IsChild          bool
 
        common.NoPKModel
 }
@@ -63,6 +64,8 @@ type GitlabPipelineProject struct {
        GitlabCreatedAt *time.Time
        GitlabUpdatedAt *time.Time
        common.NoPKModel
+
+       IsChild bool
 }
 
 func (GitlabPipelineProject) TableName() string {

Reply via email to