aboutsummaryrefslogtreecommitdiff
path: root/models/migrations/v1_13/v151.go
diff options
context:
space:
mode:
authorJason Song2023-03-07 18:51:06 +0800
committerGitHub2023-03-07 18:51:06 +0800
commitc84238800bb743181582f043ece9b44fef233c95 (patch)
tree83cf618233bb1a51c4a3325f8fa7662bb136afb1 /models/migrations/v1_13/v151.go
parent84a299310d9a8f6387f18a1711485b7f33e6f6b5 (diff)
Refactor `setting.Database.UseXXX` to methods (#23354)
Replace #23350. Refactor `setting.Database.UseMySQL` to `setting.Database.Type.IsMySQL()`. To avoid mismatching between `Type` and `UseXXX`. This refactor can fix the bug mentioned in #23350, so it should be backported.
Diffstat (limited to 'models/migrations/v1_13/v151.go')
-rw-r--r--models/migrations/v1_13/v151.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/models/migrations/v1_13/v151.go b/models/migrations/v1_13/v151.go
index 9490c1778..9aa71ec29 100644
--- a/models/migrations/v1_13/v151.go
+++ b/models/migrations/v1_13/v151.go
@@ -17,13 +17,13 @@ import (
func SetDefaultPasswordToArgon2(x *xorm.Engine) error {
switch {
- case setting.Database.UseMySQL:
+ case setting.Database.Type.IsMySQL():
_, err := x.Exec("ALTER TABLE `user` ALTER passwd_hash_algo SET DEFAULT 'argon2';")
return err
- case setting.Database.UsePostgreSQL:
+ case setting.Database.Type.IsPostgreSQL():
_, err := x.Exec("ALTER TABLE `user` ALTER COLUMN passwd_hash_algo SET DEFAULT 'argon2';")
return err
- case setting.Database.UseMSSQL:
+ case setting.Database.Type.IsMSSQL():
// need to find the constraint and drop it, then recreate it.
sess := x.NewSession()
defer sess.Close()
@@ -53,7 +53,7 @@ func SetDefaultPasswordToArgon2(x *xorm.Engine) error {
}
return sess.Commit()
- case setting.Database.UseSQLite3:
+ case setting.Database.Type.IsSQLite3():
// drop through
default:
log.Fatal("Unrecognized DB")