aboutsummaryrefslogtreecommitdiff
path: root/models/migrations/v1_13/v145.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/v145.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/v145.go')
-rw-r--r--models/migrations/v1_13/v145.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/models/migrations/v1_13/v145.go b/models/migrations/v1_13/v145.go
index c96e79f8a..ee40bfc77 100644
--- a/models/migrations/v1_13/v145.go
+++ b/models/migrations/v1_13/v145.go
@@ -21,7 +21,7 @@ func IncreaseLanguageField(x *xorm.Engine) error {
return err
}
- if setting.Database.UseSQLite3 {
+ if setting.Database.Type.IsSQLite3() {
// SQLite maps VARCHAR to TEXT without size so we're done
return nil
}
@@ -41,11 +41,11 @@ func IncreaseLanguageField(x *xorm.Engine) error {
}
switch {
- case setting.Database.UseMySQL:
+ case setting.Database.Type.IsMySQL():
if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE language_stat MODIFY COLUMN language %s", sqlType)); err != nil {
return err
}
- case setting.Database.UseMSSQL:
+ case setting.Database.Type.IsMSSQL():
// Yet again MSSQL just has to be awkward.
// Here we have to drop the constraints first and then rebuild them
constraints := make([]string, 0)
@@ -71,7 +71,7 @@ func IncreaseLanguageField(x *xorm.Engine) error {
if err := sess.CreateUniques(new(LanguageStat)); err != nil {
return err
}
- case setting.Database.UsePostgreSQL:
+ case setting.Database.Type.IsPostgreSQL():
if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE language_stat ALTER COLUMN language TYPE %s", sqlType)); err != nil {
return err
}