You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ly...@apache.org on 2024/09/06 06:50:08 UTC

(incubator-devlake) 01/01: feat(domain): add is_child field to table cicd_pipelines

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

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

commit a6854bdf976fbe0a25f3e857e5b5d5cd8ddaa922
Author: d4x1 <15...@qq.com>
AuthorDate: Fri Sep 6 14:49:53 2024 +0800

    feat(domain): add is_child field to table cicd_pipelines
---
 .../models/domainlayer/devops/cicd_pipeline.go     |  1 +
 .../20240906_add_is_child_to_cicd_pipelines.go     | 52 ++++++++++++++++++++++
 backend/core/models/migrationscripts/register.go   |  1 +
 3 files changed, 54 insertions(+)

diff --git a/backend/core/models/domainlayer/devops/cicd_pipeline.go b/backend/core/models/domainlayer/devops/cicd_pipeline.go
index e05d573b6..3a0a34f46 100644
--- a/backend/core/models/domainlayer/devops/cicd_pipeline.go
+++ b/backend/core/models/domainlayer/devops/cicd_pipeline.go
@@ -40,6 +40,7 @@ type CICDPipeline struct {
 	Environment       string `gorm:"type:varchar(255)"`
 	TaskDatesInfo
 	CicdScopeId string `gorm:"index;type:varchar(255)"`
+	IsChild     bool
 }
 
 func (CICDPipeline) TableName() string {
diff --git a/backend/core/models/migrationscripts/20240906_add_is_child_to_cicd_pipelines.go b/backend/core/models/migrationscripts/20240906_add_is_child_to_cicd_pipelines.go
new file mode 100644
index 000000000..3cf14e8d9
--- /dev/null
+++ b/backend/core/models/migrationscripts/20240906_add_is_child_to_cicd_pipelines.go
@@ -0,0 +1,52 @@
+/*
+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"
+	"github.com/apache/incubator-devlake/core/plugin"
+)
+
+var _ plugin.MigrationScript = (*addIsChildToCicdPipeline)(nil)
+
+type cicdPipeline20240906 struct {
+	IsChild bool
+}
+
+func (cicdPipeline20240906) TableName() string {
+	return "cicd_pipelines"
+}
+
+type addIsChildToCicdPipeline struct{}
+
+func (*addIsChildToCicdPipeline) Up(basicRes context.BasicRes) errors.Error {
+	db := basicRes.GetDal()
+	if err := db.AutoMigrate(&cicdPipeline20240906{}); err != nil {
+		return err
+	}
+	return nil
+}
+
+func (*addIsChildToCicdPipeline) Version() uint64 {
+	return 20240906120000
+}
+
+func (*addIsChildToCicdPipeline) Name() string {
+	return "add is_child to cicd_pipelines"
+}
diff --git a/backend/core/models/migrationscripts/register.go b/backend/core/models/migrationscripts/register.go
index 6236fa289..fa349d6b3 100644
--- a/backend/core/models/migrationscripts/register.go
+++ b/backend/core/models/migrationscripts/register.go
@@ -132,5 +132,6 @@ func All() []plugin.MigrationScript {
 		new(addDateFieldsToProjectPrMetric),
 		new(addAssigneeToIncident),
 		new(addIsSubtaskToIssue),
+		new(addIsChildToCicdPipeline),
 	}
 }