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 2022/07/22 09:40:16 UTC

[incubator-devlake] 11/13: fix: drop commitfile table before automigrate table

This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 0a530044dc8def0b864c6ff930459b42f7a04706
Author: xgdyp <zx...@163.com>
AuthorDate: Fri Jul 22 16:47:29 2022 +0800

    fix: drop commitfile table before automigrate table
---
 models/migrationscripts/20220722_commitfile_component.go | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/models/migrationscripts/20220722_commitfile_component.go b/models/migrationscripts/20220722_commitfile_component.go
index e4a9c17e..88a346a8 100644
--- a/models/migrationscripts/20220722_commitfile_component.go
+++ b/models/migrationscripts/20220722_commitfile_component.go
@@ -59,8 +59,11 @@ func (CommitFileComponent) TableName() string {
 type commitfileComponent struct{}
 
 func (*commitfileComponent) Up(ctx context.Context, db *gorm.DB) error {
-
-	err := db.Migrator().AutoMigrate(Component{}, CommitFile{}, CommitFileComponent{})
+	err := db.Migrator().DropTable(&CommitFile{})
+	if err != nil {
+		return err
+	}
+	err = db.Migrator().AutoMigrate(Component{}, CommitFile{}, CommitFileComponent{})
 	if err != nil {
 		return err
 	}