warren830 commented on code in PR #2147:
URL: https://github.com/apache/incubator-devlake/pull/2147#discussion_r896566824


##########
plugins/gitlab/models/migrationscripts/init_schema.go:
##########
@@ -39,11 +66,55 @@ func (*InitSchemas) Up(ctx context.Context, db *gorm.DB) 
error {
                &archived.GitlabMergeRequestCommit{},
                &archived.GitlabMergeRequestComment{},
                &archived.GitlabUser{},
+               &archived.GitlabConnection{},
+               &archived.GitlabIssue{},
+               &archived.GitlabIssueLabel{},
        )
+
+       if err != nil {
+               return err
+       }
+
+       err = db.Migrator().AutoMigrate(
+               &archived.GitlabProject{},
+               &archived.GitlabMergeRequest{},
+               &archived.GitlabCommit{},
+               &archived.GitlabTag{},
+               &archived.GitlabProjectCommit{},
+               &archived.GitlabPipeline{},
+               &archived.GitlabReviewer{},
+               &archived.GitlabMergeRequestNote{},
+               &archived.GitlabMergeRequestCommit{},
+               &archived.GitlabMergeRequestComment{},
+               &archived.GitlabUser{},
+               &archived.GitlabConnection{},
+               &archived.GitlabIssue{},
+               &archived.GitlabIssueLabel{},
+       )
+
+       if err != nil {
+               return err
+       }
+
+       conn := &archived.GitlabConnection{}
+       v := config.GetConfig()
+       conn.Name = "first connection"
+       conn.ID = 1
+       conn.Endpoint = v.GetString("GITLAB_ENDPOINT")
+       conn.Token = v.GetString("GITLAB_AUTH")
+       conn.Proxy = v.GetString("GITLAB_PROXY")
+       conn.RateLimit = v.GetInt("GITLAB_API_REQUESTS_PER_HOUR")
+       fmt.Println(conn.Endpoint)
+       err = db.Clauses(clause.OnConflict{DoNothing: true}).Create(conn).Error
+
+       if err != nil {
+               return err
+       }
+       return nil
 }
 
 func (*InitSchemas) Version() uint64 {
-       return 20220407201136
+       return 202206147201136

Review Comment:
   My mistake…



-- 
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]

Reply via email to