handle repository.size column being NULL in migration v263 (#28336) (#28363)

Co-authored-by: Nate Levesque <nate@thenaterhood.com>
This commit is contained in:
Giteabot 2023-12-05 22:51:56 +08:00 committed by GitHub
parent fef34790bb
commit 5b5f8aab19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -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
}