Skip to content

Commit b400816

Browse files
committed
Ignore sqlite on migration
1 parent c30dbd8 commit b400816

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

models/migrations/v165.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ import (
1010
)
1111

1212
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+
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)"

0 commit comments

Comments
 (0)