File tree Expand file tree Collapse file tree
plugins/github/models/migrationscripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,8 +87,6 @@ type BlueprintConnectionV200 struct {
8787type BlueprintScopeV200 struct {
8888 Id string `json:"id"`
8989 Name string `json:"name"`
90- // Deprecated: Entities is moved to the ScopeConfig struct
91- Entities []string `json:"entities"`
9290}
9391
9492// MetricPluginBlueprintV200 is similar to the DataSourcePluginBlueprintV200
Original file line number Diff line number Diff line change @@ -18,12 +18,18 @@ limitations under the License.
1818package migrationscripts
1919
2020import (
21+ "strings"
22+
2123 "github.com/apache/incubator-devlake/core/context"
2224 "github.com/apache/incubator-devlake/core/errors"
25+ "github.com/apache/incubator-devlake/helpers/migrationhelper"
2326)
2427
2528type githubRepo20230612 struct {
26- FullName string `gorm:"type:varchar(255)"`
29+ ConnectionId uint64 `gorm:"primaryKey"`
30+ GithubId int `gorm:"primaryKey"`
31+ Name string `gorm:"type:varchar(255)"`
32+ FullName string `gorm:"type:varchar(255)"`
2733}
2834
2935func (githubRepo20230612 ) TableName () string {
@@ -33,12 +39,29 @@ func (githubRepo20230612) TableName() string {
3339type addFullName struct {}
3440
3541func (* addFullName ) Up (res context.BasicRes ) errors.Error {
42+ gr := & githubRepo20230612 {}
3643 db := res .GetDal ()
37- return db .AutoMigrate (& githubRepo20230612 {})
44+ err := db .AutoMigrate (gr )
45+ if err != nil {
46+ return err
47+ }
48+ return migrationhelper .CopyTableColumns [githubRepo20230612 , githubRepo20230612 ](
49+ res ,
50+ gr .TableName (),
51+ gr .TableName (),
52+ func (gr * githubRepo20230612 ) (* githubRepo20230612 , errors.Error ) {
53+ fn := strings .Split (gr .Name , "/" )
54+ if len (fn ) == 2 {
55+ gr .FullName = gr .Name
56+ gr .Name = fn [1 ]
57+ }
58+ return gr , nil
59+ },
60+ )
3861}
3962
4063func (* addFullName ) Version () uint64 {
41- return 20230612184110
64+ return 20230612184111
4265}
4366
4467func (* addFullName ) Name () string {
You can’t perform that action at this time.
0 commit comments