mirror of
https://github.com/zhufuyi/sponge.git
synced 2025-10-06 01:07:08 +08:00
fix: postgresql comments single quote problem
This commit is contained in:
@@ -34,7 +34,8 @@ func ConvertToSQLByPgFields(tableName string, fields PGFields) (string, map[stri
|
||||
if !field.Notnull {
|
||||
notnullStr = "null"
|
||||
}
|
||||
fieldStr += fmt.Sprintf(" `%s` %s %s comment '%s',\n", field.Name, sqlType, notnullStr, field.Comment)
|
||||
comment := strings.ReplaceAll(field.Comment, "'", "\\'")
|
||||
fieldStr += fmt.Sprintf(" `%s` %s %s comment '%s',\n", field.Name, sqlType, notnullStr, comment)
|
||||
}
|
||||
|
||||
primaryField := fields.getPrimaryField()
|
||||
|
Reference in New Issue
Block a user