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 2023/08/24 07:39:56 UTC
[incubator-devlake] branch release-v0.18 updated: GitHub fails after upgrade to v0.18 (#5946) (#5947)
This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch release-v0.18
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v0.18 by this push:
new 64c82ace6 GitHub fails after upgrade to v0.18 (#5946) (#5947)
64c82ace6 is described below
commit 64c82ace63c55e8778db31b5d7747306faf097a6
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Thu Aug 24 15:39:47 2023 +0800
GitHub fails after upgrade to v0.18 (#5946) (#5947)
* fix: remove deprecated BlueprintScopeV200.Entities
* fix: missing migration logic in 20230612_add_fullName
Co-authored-by: Klesh Wong <zh...@merico.dev>
---
backend/core/plugin/plugin_blueprint.go | 2 --
.../migrationscripts/20230612_add_fullName.go | 29 +++++++++++++++++++---
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/backend/core/plugin/plugin_blueprint.go b/backend/core/plugin/plugin_blueprint.go
index 68aa1c51c..e86379f5b 100644
--- a/backend/core/plugin/plugin_blueprint.go
+++ b/backend/core/plugin/plugin_blueprint.go
@@ -87,8 +87,6 @@ type BlueprintConnectionV200 struct {
type BlueprintScopeV200 struct {
Id string `json:"id"`
Name string `json:"name"`
- // Deprecated: Entities is moved to the ScopeConfig struct
- Entities []string `json:"entities"`
}
// MetricPluginBlueprintV200 is similar to the DataSourcePluginBlueprintV200
diff --git a/backend/plugins/github/models/migrationscripts/20230612_add_fullName.go b/backend/plugins/github/models/migrationscripts/20230612_add_fullName.go
index 447c1537c..6a1034b23 100644
--- a/backend/plugins/github/models/migrationscripts/20230612_add_fullName.go
+++ b/backend/plugins/github/models/migrationscripts/20230612_add_fullName.go
@@ -18,12 +18,18 @@ limitations under the License.
package migrationscripts
import (
+ "strings"
+
"github.com/apache/incubator-devlake/core/context"
"github.com/apache/incubator-devlake/core/errors"
+ "github.com/apache/incubator-devlake/helpers/migrationhelper"
)
type githubRepo20230612 struct {
- FullName string `gorm:"type:varchar(255)"`
+ ConnectionId uint64 `gorm:"primaryKey"`
+ GithubId int `gorm:"primaryKey"`
+ Name string `gorm:"type:varchar(255)"`
+ FullName string `gorm:"type:varchar(255)"`
}
func (githubRepo20230612) TableName() string {
@@ -33,12 +39,29 @@ func (githubRepo20230612) TableName() string {
type addFullName struct{}
func (*addFullName) Up(res context.BasicRes) errors.Error {
+ gr := &githubRepo20230612{}
db := res.GetDal()
- return db.AutoMigrate(&githubRepo20230612{})
+ err := db.AutoMigrate(gr)
+ if err != nil {
+ return err
+ }
+ return migrationhelper.CopyTableColumns[githubRepo20230612, githubRepo20230612](
+ res,
+ gr.TableName(),
+ gr.TableName(),
+ func(gr *githubRepo20230612) (*githubRepo20230612, errors.Error) {
+ fn := strings.Split(gr.Name, "/")
+ if len(fn) == 2 {
+ gr.FullName = gr.Name
+ gr.Name = fn[1]
+ }
+ return gr, nil
+ },
+ )
}
func (*addFullName) Version() uint64 {
- return 20230612184110
+ return 20230612184111
}
func (*addFullName) Name() string {