Skip to content

Commit

Permalink
feat: check for empty slice when create newHistory and newReviewVote
Browse files Browse the repository at this point in the history
  • Loading branch information
JingYiJun committed Sep 26, 2023
1 parent 9d82392 commit 7b369b0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions cmd/migrate/danke_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,18 @@ func DankeV3() {
}
}

err = tx.Create(&newHistory).Error
if err != nil {
return err
if len(newHistory) > 0 {
err = tx.Create(&newHistory).Error
if err != nil {
return err
}
}

err = tx.Create(&newReviewVote).Error
if err != nil {
return err
if len(newReviewVote) > 0 {
err = tx.Create(&newReviewVote).Error
if err != nil {
return err
}
}

return nil
Expand Down

0 comments on commit 7b369b0

Please sign in to comment.