forked from kevadesu/forgejo
Rename db Engines related functions (#17481)
* Rename db Engines related functions Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
76a3190b8a
commit
63c0dc89ef
14 changed files with 31 additions and 31 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue