klesh commented on code in PR #2314:
URL: https://github.com/apache/incubator-devlake/pull/2314#discussion_r905992677
##########
plugins/ae/models/migrationscripts/init_schema.go:
##########
@@ -21,20 +21,63 @@ import (
"context"
"github.com/apache/incubator-devlake/plugins/ae/models/migrationscripts/archived"
+ "github.com/apache/incubator-devlake/plugins/core"
+ "github.com/apache/incubator-devlake/plugins/helper"
"gorm.io/gorm"
)
-type InitSchemas struct{}
+type InitSchemas struct {
+ config core.ConfigGetter
+}
+
+func (u *InitSchemas) SetConfigGetter(config core.ConfigGetter) {
+ u.config = config
+}
-func (*InitSchemas) Up(ctx context.Context, db *gorm.DB) error {
- return db.Migrator().AutoMigrate(
+func (u *InitSchemas) Up(ctx context.Context, db *gorm.DB) error {
+ err := db.Migrator().DropTable(
&archived.AECommit{},
&archived.AEProject{},
+ &archived.AeConnection{},
Review Comment:
I don't think this is needed.
##########
plugins/ae/models/migrationscripts/init_schema.go:
##########
@@ -21,20 +21,63 @@ import (
"context"
"github.com/apache/incubator-devlake/plugins/ae/models/migrationscripts/archived"
+ "github.com/apache/incubator-devlake/plugins/core"
+ "github.com/apache/incubator-devlake/plugins/helper"
"gorm.io/gorm"
)
-type InitSchemas struct{}
+type InitSchemas struct {
+ config core.ConfigGetter
+}
+
+func (u *InitSchemas) SetConfigGetter(config core.ConfigGetter) {
+ u.config = config
+}
-func (*InitSchemas) Up(ctx context.Context, db *gorm.DB) error {
- return db.Migrator().AutoMigrate(
+func (u *InitSchemas) Up(ctx context.Context, db *gorm.DB) error {
+ err := db.Migrator().DropTable(
&archived.AECommit{},
&archived.AEProject{},
+ &archived.AeConnection{},
+ "_raw_ae_project",
+ "_raw_ae_commits",
)
+ if err != nil {
+ return err
+ }
+
+ err = db.Migrator().AutoMigrate(
+ &archived.AECommit{},
+ &archived.AEProject{},
+ &archived.AeConnection{},
+ )
+ if err != nil {
+ return err
+ }
+
+ encodeKey := u.config.GetString(core.EncodeKeyEnvStr)
+ connection := &archived.AeConnection{}
+ connection.Endpoint = u.config.GetString("AE_ENDPOINT")
+ connection.Proxy = u.config.GetString("GITHUB_PROXY")
Review Comment:
`AE_PROXY` ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]