Rename db Engines related functions (#17481)

* Rename db Engines related functions

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Lunny Xiao 2021-10-30 22:32:11 +08:00 committed by GitHub
parent 76a3190b8a
commit 63c0dc89ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 31 additions and 31 deletions

View file

@ -65,7 +65,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

View file

@ -96,7 +96,7 @@ func runRecreateTable(ctx *cli.Context) error {
setting.Cfg.Section("log").Key("XORM").SetValue(",")
setting.NewXORMLogService(!ctx.Bool("debug"))
if err := db.SetEngine(); err != nil {
if err := db.InitEngine(); err != nil {
fmt.Println(err)
fmt.Println("Check if you are using the right config file. You can use a --config directive to specify one.")
return nil
@ -114,7 +114,7 @@ func runRecreateTable(ctx *cli.Context) error {
}
recreateTables := migrations.RecreateTables(beans...)
return db.NewEngine(context.Background(), func(x *xorm.Engine) error {
return db.InitEngineWithMigration(context.Background(), func(x *xorm.Engine) error {
if err := migrations.EnsureUpToDate(x); err != nil {
return err
}

View file

@ -173,7 +173,7 @@ func runDump(ctx *cli.Context) error {
}
setting.NewServices() // cannot access session settings otherwise
err := db.SetEngine()
err := db.InitEngine()
if err != nil {
return err
}

View file

@ -35,7 +35,7 @@ func runMigrate(ctx *cli.Context) error {
log.Info("Configuration file: %s", setting.CustomConf)
setting.InitDBConfig()
if err := db.NewEngine(context.Background(), migrations.Migrate); err != nil {
if err := db.InitEngineWithMigration(context.Background(), migrations.Migrate); err != nil {
log.Fatal("Failed to initialize ORM engine: %v", err)
return err
}

View file

@ -118,7 +118,7 @@ func runMigrateStorage(ctx *cli.Context) error {
log.Info("Configuration file: %s", setting.CustomConf)
setting.InitDBConfig()
if err := db.NewEngine(context.Background(), migrations.Migrate); err != nil {
if err := db.InitEngineWithMigration(context.Background(), migrations.Migrate); err != nil {
log.Fatal("Failed to initialize ORM engine: %v", err)
return err
}