warren830 commented on code in PR #2147:
URL: https://github.com/apache/incubator-devlake/pull/2147#discussion_r896553423
##########
plugins/gitlab/models/migrationscripts/init_schema.go:
##########
@@ -19,15 +19,42 @@ package migrationscripts
import (
"context"
-
+ "fmt"
+ "github.com/apache/incubator-devlake/config"
"github.com/apache/incubator-devlake/plugins/gitlab/models/migrationscripts/archived"
"gorm.io/gorm"
+ "gorm.io/gorm/clause"
)
type InitSchemas struct{}
+type RawMr struct {
+}
+
+func (r RawMr) tableName() string {
+ return "_raw_gitlab_merge_requests"
+}
+
func (*InitSchemas) Up(ctx context.Context, db *gorm.DB) error {
- return db.Migrator().AutoMigrate(
+ rawTableList := []string{
+ "_raw_gitlab_api_children_on_pipeline",
+ "_raw_gitlab_api_commit",
+ "_raw_gitlab_api_issues",
+ "_raw_gitlab_api_merge_request_commits",
+ "_raw_gitlab_api_merge_request_notes",
+ "_raw_gitlab_api_merge_requests",
+ "_raw_gitlab_api_pipeline",
+ "_raw_gitlab_api_project",
+ "_raw_gitlab_api_tag",
+ }
+ for _, v := range rawTableList {
+ err := db.Exec(fmt.Sprintf("DROP TABLE IF EXISTS %s CASCADE",
v)).Error
+ if err != nil {
+ return err
+ }
+ }
+
+ err := db.Migrator().DropTable(
Review Comment:
I only dropped tables belong to gitlab including all raw and tool tables.
--
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]