fix(memory): Use text as the underlying type of string (#129)

This commit is contained in:
liuyunchao-1998 2025-07-28 17:40:33 +08:00 committed by GitHub
parent b299adacf3
commit 4a44c0ddbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -33,7 +33,7 @@ const (
func SwitchToDataType(itemType table.FieldItemType) entity.DataType { func SwitchToDataType(itemType table.FieldItemType) entity.DataType {
switch itemType { switch itemType {
case table.FieldItemType_Text: case table.FieldItemType_Text:
return entity.TypeVarchar return entity.TypeText
case table.FieldItemType_Number: case table.FieldItemType_Number:
return entity.TypeBigInt return entity.TypeBigInt
case table.FieldItemType_Date: case table.FieldItemType_Date:

View File

@ -64,6 +64,8 @@ func (m *mysqlService) CreateTable(ctx context.Context, req *rdb.CreateTableRequ
if col.DefaultValue != nil { if col.DefaultValue != nil {
if col.DataType == entity2.TypeTimestamp { if col.DataType == entity2.TypeTimestamp {
colDef += fmt.Sprintf(" DEFAULT %s", *col.DefaultValue) colDef += fmt.Sprintf(" DEFAULT %s", *col.DefaultValue)
} else if col.DataType == entity2.TypeText {
// do nothing
} else { } else {
colDef += fmt.Sprintf(" DEFAULT '%s'", *col.DefaultValue) colDef += fmt.Sprintf(" DEFAULT '%s'", *col.DefaultValue)
} }