Skip to content

Commit

Permalink
handle repository.size column being NULL in migration v263 (#28336) (#…
Browse files Browse the repository at this point in the history
…28363)

Co-authored-by: Nate Levesque <nate@thenaterhood.com>
  • Loading branch information
GiteaBot and thenaterhood committed Dec 5, 2023
1 parent fef3479 commit 5b5f8aa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion models/migrations/v1_21/v263.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ func AddGitSizeAndLFSSizeToRepositoryTable(x *xorm.Engine) error {
return err
}

_, err = sess.Exec(`UPDATE repository SET git_size = size - lfs_size`)
_, err = sess.Exec(`UPDATE repository SET size = 0 WHERE size IS NULL`)
if err != nil {
return err
}

_, err = sess.Exec(`UPDATE repository SET git_size = size - lfs_size WHERE size > lfs_size`)
if err != nil {
return err
}
Expand Down

0 comments on commit 5b5f8aa

Please sign in to comment.