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 <[email protected]>
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
        }

Reply via email to