summaryrefslogtreecommitdiffstats
path: root/cmd
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 /cmd
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 'cmd')
-rw-r--r--cmd/cmd.go2
-rw-r--r--cmd/doctor.go4
-rw-r--r--cmd/dump.go2
-rw-r--r--cmd/migrate.go2
-rw-r--r--cmd/migrate_storage.go2
5 files changed, 6 insertions, 6 deletions
diff --git a/cmd/cmd.go b/cmd/cmd.go
index bb7ab8f9b7..ea025cd98e 100644
--- a/cmd/cmd.go
+++ b/cmd/cmd.go
@@ -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
diff --git a/cmd/doctor.go b/cmd/doctor.go
index 31708e990d..19b26f09c6 100644
--- a/cmd/doctor.go
+++ b/cmd/doctor.go
@@ -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
}
diff --git a/cmd/dump.go b/cmd/dump.go
index fd89eb89f9..70ed6c2b55 100644
--- a/cmd/dump.go
+++ b/cmd/dump.go
@@ -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
}
diff --git a/cmd/migrate.go b/cmd/migrate.go
index a5dfed20b2..7bb87d8400 100644
--- a/cmd/migrate.go
+++ b/cmd/migrate.go
@@ -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
}
diff --git a/cmd/migrate_storage.go b/cmd/migrate_storage.go
index d9ca8a0839..7c7629490e 100644
--- a/cmd/migrate_storage.go
+++ b/cmd/migrate_storage.go
@@ -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
}