diff options
author | 6543 <6543@obermui.de> | 2020-05-29 20:00:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-29 13:00:43 -0500 |
commit | d9db28a25a59b4493cffba044de39e5a25031cef (patch) | |
tree | 1dafa78baecd8f1c65b8721489a291aac4e5bc27 /models/models.go | |
parent | 5911e129a8bb298338f15c8dd50d26bf7f0be3f0 (diff) | |
download | gitea-d9db28a25a59b4493cffba044de39e5a25031cef.tar.gz gitea-d9db28a25a59b4493cffba044de39e5a25031cef.zip |
Doctor check & fix db consistency (#11111) (#11676)
needed to fix issue as described in #10280
* rename check-db to check-db-version
* add check-db-consistency:
* find issues without existing repository
* find pulls without existing issues
* find tracked times without existing issues/pulls
* find labels without repository or org reference
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models/models.go')
-rw-r--r-- | models/models.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/models/models.go b/models/models.go index c818c65100..7f12d6260a 100644 --- a/models/models.go +++ b/models/models.go @@ -182,6 +182,10 @@ func SetEngine() (err error) { } // NewEngine initializes a new xorm.Engine +// This function must never call .Sync2() if the provided migration function fails. +// When called from the "doctor" command, the migration function is a version check +// that prevents the doctor from fixing anything in the database if the migration level +// is different from the expected value. func NewEngine(ctx context.Context, migrateFunc func(*xorm.Engine) error) (err error) { if err = SetEngine(); err != nil { return err |