mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Rename db Engines related functions (#17481)
* Rename db Engines related functions Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user