File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,14 @@ import (
10
10
)
11
11
12
12
func convertHookTaskTypeToVarcharAndTrim (x * xorm.Engine ) error {
13
+ dbType := x .Dialect ().URI ().DBType
14
+ if dbType == schemas .SQLITE { // For SQLITE, varchar or char will always be represented as TEXT
15
+ return nil
16
+ }
17
+
13
18
type HookTask struct {
14
19
Typ string `xorm:"VARCHAR(16) index"`
15
20
}
16
-
17
21
alterSQL := x .Dialect ().ModifyColumnSQL ("hook_task" , & schemas.Column {
18
22
Name : "typ" ,
19
23
TableName : "hook_task" ,
@@ -28,7 +32,7 @@ func convertHookTaskTypeToVarcharAndTrim(x *xorm.Engine) error {
28
32
}
29
33
30
34
var hookTaskTrimSQL string
31
- if x . Dialect (). URI (). DBType == schemas .MSSQL {
35
+ if dbType == schemas .MSSQL {
32
36
hookTaskTrimSQL = "UPDATE hook_task SET typ = RTRIM(LTRIM(typ))"
33
37
} else {
34
38
hookTaskTrimSQL = "UPDATE hook_task SET typ = TRIM(typ)"
@@ -55,7 +59,7 @@ func convertHookTaskTypeToVarcharAndTrim(x *xorm.Engine) error {
55
59
}
56
60
57
61
var webhookTrimSQL string
58
- if x . Dialect (). URI (). DBType == schemas .MSSQL {
62
+ if dbType == schemas .MSSQL {
59
63
webhookTrimSQL = "UPDATE webhook SET type = RTRIM(LTRIM(type))"
60
64
} else {
61
65
webhookTrimSQL = "UPDATE webhook SET type = TRIM(type)"
You can’t perform that action at this time.
0 commit comments