summaryrefslogtreecommitdiffstats
path: root/modules/doctor
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-10-30 22:32:11 +0800
committerGitHub <noreply@github.com>2021-10-30 22:32:11 +0800
commit63c0dc89ef96a2e38b38aa6cba5e4e8d1d7b9150 (patch)
tree91da225f6e02bba47fbe5677e18d6617e43aedcd /modules/doctor
parent76a3190b8a988e18a6b5d66dcc7324f04d83342f (diff)
downloadgitea-63c0dc89ef96a2e38b38aa6cba5e4e8d1d7b9150.tar.gz
gitea-63c0dc89ef96a2e38b38aa6cba5e4e8d1d7b9150.zip
Rename db Engines related functions (#17481)
* Rename db Engines related functions Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'modules/doctor')
-rw-r--r--modules/doctor/dbconsistency.go2
-rw-r--r--modules/doctor/dbversion.go4
-rw-r--r--modules/doctor/doctor.go2
3 files changed, 4 insertions, 4 deletions
diff --git a/modules/doctor/dbconsistency.go b/modules/doctor/dbconsistency.go
index 987bd58db8..040f73abcd 100644
--- a/modules/doctor/dbconsistency.go
+++ b/modules/doctor/dbconsistency.go
@@ -74,7 +74,7 @@ func genericOrphanCheck(name, subject, refobject, joincond string) consistencyCh
func checkDBConsistency(logger log.Logger, autofix bool) error {
// make sure DB version is uptodate
- if err := db.NewEngine(context.Background(), migrations.EnsureUpToDate); err != nil {
+ if err := db.InitEngineWithMigration(context.Background(), migrations.EnsureUpToDate); err != nil {
logger.Critical("Model version on the database does not match the current Gitea version. Model consistency will not be checked until the database is upgraded")
return err
}
diff --git a/modules/doctor/dbversion.go b/modules/doctor/dbversion.go
index acc564bdb0..0fc6762e47 100644
--- a/modules/doctor/dbversion.go
+++ b/modules/doctor/dbversion.go
@@ -13,7 +13,7 @@ import (
)
func checkDBVersion(logger log.Logger, autofix bool) error {
- if err := db.NewEngine(context.Background(), migrations.EnsureUpToDate); err != nil {
+ if err := db.InitEngineWithMigration(context.Background(), migrations.EnsureUpToDate); err != nil {
if !autofix {
logger.Critical("Error: %v during ensure up to date", err)
return err
@@ -21,7 +21,7 @@ func checkDBVersion(logger log.Logger, autofix bool) error {
logger.Warn("Got Error: %v during ensure up to date", err)
logger.Warn("Attempting to migrate to the latest DB version to fix this.")
- err = db.NewEngine(context.Background(), migrations.Migrate)
+ err = db.InitEngineWithMigration(context.Background(), migrations.Migrate)
if err != nil {
logger.Critical("Error: %v during migration", err)
}
diff --git a/modules/doctor/doctor.go b/modules/doctor/doctor.go
index d5cc4a1850..9a05e828f4 100644
--- a/modules/doctor/doctor.go
+++ b/modules/doctor/doctor.go
@@ -47,7 +47,7 @@ func initDBDisableConsole(disableConsole bool) error {
setting.InitDBConfig()
setting.NewXORMLogService(disableConsole)
- if err := db.SetEngine(); err != nil {
+ if err := db.InitEngine(); err != nil {
return fmt.Errorf("models.SetEngine: %v", err)
}
return nil