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 (
1010)
1111
1212func 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+
1318 type HookTask struct {
1419 Typ string `xorm:"VARCHAR(16) index"`
1520 }
16-
1721 alterSQL := x .Dialect ().ModifyColumnSQL ("hook_task" , & schemas.Column {
1822 Name : "typ" ,
1923 TableName : "hook_task" ,
@@ -28,7 +32,7 @@ func convertHookTaskTypeToVarcharAndTrim(x *xorm.Engine) error {
2832 }
2933
3034 var hookTaskTrimSQL string
31- if x . Dialect (). URI (). DBType == schemas .MSSQL {
35+ if dbType == schemas .MSSQL {
3236 hookTaskTrimSQL = "UPDATE hook_task SET typ = RTRIM(LTRIM(typ))"
3337 } else {
3438 hookTaskTrimSQL = "UPDATE hook_task SET typ = TRIM(typ)"
@@ -55,7 +59,7 @@ func convertHookTaskTypeToVarcharAndTrim(x *xorm.Engine) error {
5559 }
5660
5761 var webhookTrimSQL string
58- if x . Dialect (). URI (). DBType == schemas .MSSQL {
62+ if dbType == schemas .MSSQL {
5963 webhookTrimSQL = "UPDATE webhook SET type = RTRIM(LTRIM(type))"
6064 } else {
6165 webhookTrimSQL = "UPDATE webhook SET type = TRIM(type)"
You can’t perform that action at this time.
0 commit comments