Skip to content

Commit b04900e

Browse files
artloArtem Lobanov
and
Artem Lobanov
authored
fix text default value produces "'::text'" as value (#210)
Co-authored-by: Artem Lobanov <artem.lobanov@vk.team>
1 parent 1eba307 commit b04900e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

migrator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ func (m Migrator) ColumnTypes(value interface{}) (columnTypes []gorm.ColumnType,
477477
}
478478

479479
if column.DefaultValueValue.Valid {
480-
column.DefaultValueValue.String = regexp.MustCompile(`'?(.*)\b?'?::[\w ]+$`).ReplaceAllString(column.DefaultValueValue.String, "$2")
480+
column.DefaultValueValue.String = regexp.MustCompile(`'?(.*\b|)'?:+[\w\s]+$`).ReplaceAllString(column.DefaultValueValue.String, "$1")
481481
}
482482

483483
if datetimePrecision.Valid {

0 commit comments

Comments
 (0)