Skip to content

Commit 63e0ce6

Browse files
authored
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`
1 parent a164de4 commit 63e0ce6

File tree

4 files changed

+98
-0
lines changed

4 files changed

+98
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with
4+
this work for additional information regarding copyright ownership.
5+
The ASF licenses this file to You under the Apache License, Version 2.0
6+
(the "License"); you may not use this file except in compliance with
7+
the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
17+
18+
package migrationscripts
19+
20+
import (
21+
"github.com/apache/incubator-devlake/core/context"
22+
"github.com/apache/incubator-devlake/core/errors"
23+
"github.com/apache/incubator-devlake/core/plugin"
24+
)
25+
26+
var _ plugin.MigrationScript = (*updateOpsenieScopeConfig20240614)(nil)
27+
28+
type OpsenieScopeConfig20240614 struct {
29+
ConnectionId uint64 `json:"connectionId" gorm:"index" validate:"required" mapstructure:"connectionId,omitempty"`
30+
}
31+
32+
func (o OpsenieScopeConfig20240614) TableName() string {
33+
return "_tool_opsgenie_scope_configs"
34+
}
35+
36+
type updateOpsenieScopeConfig20240614 struct{}
37+
38+
func (script *updateOpsenieScopeConfig20240614) Up(basicRes context.BasicRes) errors.Error {
39+
return basicRes.GetDal().AutoMigrate(&OpsenieScopeConfig20240614{})
40+
}
41+
42+
func (*updateOpsenieScopeConfig20240614) Version() uint64 {
43+
return 20240614110000
44+
}
45+
46+
func (script *updateOpsenieScopeConfig20240614) Name() string {
47+
return "add connection_id column to table _tool_opsgenie_scope_configs"
48+
}

backend/plugins/opsgenie/models/migrationscripts/register.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ func All() []plugin.MigrationScript {
3232
new(renameTr2ScopeConfig),
3333
new(removeScopeConfig),
3434
new(addOpsenieScopeConfig20231214),
35+
new(updateOpsenieScopeConfig20240614),
3536
}
3637
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with
4+
this work for additional information regarding copyright ownership.
5+
The ASF licenses this file to You under the Apache License, Version 2.0
6+
(the "License"); you may not use this file except in compliance with
7+
the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
17+
18+
package migrationscripts
19+
20+
import (
21+
"github.com/apache/incubator-devlake/core/context"
22+
"github.com/apache/incubator-devlake/core/errors"
23+
"github.com/apache/incubator-devlake/core/plugin"
24+
)
25+
26+
var _ plugin.MigrationScript = (*updateSonarQubeScopeConfig20240614)(nil)
27+
28+
type SonarQubeScopeConfig20240614 struct {
29+
ConnectionId uint64 `json:"connectionId" gorm:"index" validate:"required" mapstructure:"connectionId,omitempty"`
30+
}
31+
32+
func (o SonarQubeScopeConfig20240614) TableName() string {
33+
return "_tool_sonarqube_scope_configs"
34+
}
35+
36+
type updateSonarQubeScopeConfig20240614 struct{}
37+
38+
func (script *updateSonarQubeScopeConfig20240614) Up(basicRes context.BasicRes) errors.Error {
39+
return basicRes.GetDal().AutoMigrate(&SonarQubeScopeConfig20240614{})
40+
}
41+
42+
func (*updateSonarQubeScopeConfig20240614) Version() uint64 {
43+
return 20240614111000
44+
}
45+
46+
func (script *updateSonarQubeScopeConfig20240614) Name() string {
47+
return "add connection_id to table _tool_sonarqube_scope_configs"
48+
}

backend/plugins/sonarqube/models/migrationscripts/register.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ func All() []plugin.MigrationScript {
3232
new(addSonarQubeScopeConfig20231214),
3333
new(modifyCommitCharacterType),
3434
new(modifyCommitCharacterType0508),
35+
new(updateSonarQubeScopeConfig20240614),
3536
}
3637
}

0 commit comments

Comments
 (0)