e6956aa001
- React frontend with route-level code splitting - Backend rebranded from Baihu to TaskPool - DB brand migration script and local compatibility
25 lines
454 B
Go
25 lines
454 B
Go
package models
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
"gorm.io/gorm/schema"
|
|
)
|
|
|
|
// BigText 自定义大数据文本类型,自动处理跨数据库类型差异
|
|
// MySQL: LONGTEXT (4GB)
|
|
// PostgreSQL: TEXT
|
|
// SQLite: TEXT
|
|
type BigText string
|
|
|
|
func (BigText) GormDBDataType(db *gorm.DB, field *schema.Field) string {
|
|
switch db.Dialector.Name() {
|
|
case "mysql":
|
|
return "LONGTEXT"
|
|
case "postgres":
|
|
return "TEXT"
|
|
case "sqlite":
|
|
return "TEXT"
|
|
}
|
|
return "TEXT"
|
|
}
|