You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2024/06/14 03:18:22 UTC

(incubator-devlake) branch main updated: fix(opsgenie): fix errors when deleting connections (#7621)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 63e0ce6f8 fix(opsgenie): fix errors when deleting connections (#7621)
63e0ce6f8 is described below

commit 63e0ce6f88c380b5a1186e369e6fff3e897ebafa
Author: Lynwee <li...@merico.dev>
AuthorDate: Fri Jun 14 11:18:15 2024 +0800

    fix(opsgenie): fix errors when deleting connections (#7621)
    
    * fix(pagerduty): fix errors when deleting connections
    
    * fix(plugins): add missing column `connection_id` to `_tool_sonarqube_scope_configs` and `_tool_opsgenie_scope_configs`
---
 ...dd_new_fields_to_tool_opsgenie_scope_configs.go | 48 ++++++++++++++++++++++
 .../opsgenie/models/migrationscripts/register.go   |  1 +
 ...20240614_update_tool_sonarqube_scope_configs.go | 48 ++++++++++++++++++++++
 .../sonarqube/models/migrationscripts/register.go  |  1 +
 4 files changed, 98 insertions(+)

diff --git a/backend/plugins/opsgenie/models/migrationscripts/20240614_add_new_fields_to_tool_opsgenie_scope_configs.go b/backend/plugins/opsgenie/models/migrationscripts/20240614_add_new_fields_to_tool_opsgenie_scope_configs.go
new file mode 100644
index 000000000..65be3b627
--- /dev/null
+++ b/backend/plugins/opsgenie/models/migrationscripts/20240614_add_new_fields_to_tool_opsgenie_scope_configs.go
@@ -0,0 +1,48 @@
+/*
+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 = (*updateOpsenieScopeConfig20240614)(nil)
+
+type OpsenieScopeConfig20240614 struct {
+	ConnectionId uint64 `json:"connectionId" gorm:"index" validate:"required" mapstructure:"connectionId,omitempty"`
+}
+
+func (o OpsenieScopeConfig20240614) TableName() string {
+	return "_tool_opsgenie_scope_configs"
+}
+
+type updateOpsenieScopeConfig20240614 struct{}
+
+func (script *updateOpsenieScopeConfig20240614) Up(basicRes context.BasicRes) errors.Error {
+	return basicRes.GetDal().AutoMigrate(&OpsenieScopeConfig20240614{})
+}
+
+func (*updateOpsenieScopeConfig20240614) Version() uint64 {
+	return 20240614110000
+}
+
+func (script *updateOpsenieScopeConfig20240614) Name() string {
+	return "add connection_id column to table _tool_opsgenie_scope_configs"
+}
diff --git a/backend/plugins/opsgenie/models/migrationscripts/register.go b/backend/plugins/opsgenie/models/migrationscripts/register.go
index 73826452f..fd9b335aa 100644
--- a/backend/plugins/opsgenie/models/migrationscripts/register.go
+++ b/backend/plugins/opsgenie/models/migrationscripts/register.go
@@ -32,5 +32,6 @@ func All() []plugin.MigrationScript {
 		new(renameTr2ScopeConfig),
 		new(removeScopeConfig),
 		new(addOpsenieScopeConfig20231214),
+		new(updateOpsenieScopeConfig20240614),
 	}
 }
diff --git a/backend/plugins/sonarqube/models/migrationscripts/20240614_update_tool_sonarqube_scope_configs.go b/backend/plugins/sonarqube/models/migrationscripts/20240614_update_tool_sonarqube_scope_configs.go
new file mode 100644
index 000000000..35610e729
--- /dev/null
+++ b/backend/plugins/sonarqube/models/migrationscripts/20240614_update_tool_sonarqube_scope_configs.go
@@ -0,0 +1,48 @@
+/*
+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 = (*updateSonarQubeScopeConfig20240614)(nil)
+
+type SonarQubeScopeConfig20240614 struct {
+	ConnectionId uint64 `json:"connectionId" gorm:"index" validate:"required" mapstructure:"connectionId,omitempty"`
+}
+
+func (o SonarQubeScopeConfig20240614) TableName() string {
+	return "_tool_sonarqube_scope_configs"
+}
+
+type updateSonarQubeScopeConfig20240614 struct{}
+
+func (script *updateSonarQubeScopeConfig20240614) Up(basicRes context.BasicRes) errors.Error {
+	return basicRes.GetDal().AutoMigrate(&SonarQubeScopeConfig20240614{})
+}
+
+func (*updateSonarQubeScopeConfig20240614) Version() uint64 {
+	return 20240614111000
+}
+
+func (script *updateSonarQubeScopeConfig20240614) Name() string {
+	return "add connection_id to table _tool_sonarqube_scope_configs"
+}
diff --git a/backend/plugins/sonarqube/models/migrationscripts/register.go b/backend/plugins/sonarqube/models/migrationscripts/register.go
index 8640203d5..4e6297c44 100644
--- a/backend/plugins/sonarqube/models/migrationscripts/register.go
+++ b/backend/plugins/sonarqube/models/migrationscripts/register.go
@@ -32,5 +32,6 @@ func All() []plugin.MigrationScript {
 		new(addSonarQubeScopeConfig20231214),
 		new(modifyCommitCharacterType),
 		new(modifyCommitCharacterType0508),
+		new(updateSonarQubeScopeConfig20240614),
 	}
 }