1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-28 20:44:13 +00:00

Merge pull request #1879 from miraclesu/feature/orm_text

orm: use `text` as postgres default type
This commit is contained in:
astaxie 2016-04-12 23:19:22 +08:00
commit 314a447d57
2 changed files with 7 additions and 1 deletions

View File

@ -52,7 +52,11 @@ checkColumn:
case TypeBooleanField:
col = T["bool"]
case TypeCharField:
col = fmt.Sprintf(T["string"], fieldSize)
if al.Driver == DRPostgres && fi.toText {
col = T["string-text"]
} else {
col = fmt.Sprintf(T["string"], fieldSize)
}
case TypeTextField:
col = T["string-text"]
case TypeTimeField:

View File

@ -119,6 +119,7 @@ type fieldInfo struct {
colDefault bool
initial StrTo
size int
toText bool
autoNow bool
autoNowAdd bool
rel bool
@ -359,6 +360,7 @@ checkType:
}
} else {
fi.size = 255
fi.toText = true
}
case TypeTextField:
fi.index = false