Skip to content

Commit

Permalink
fix text default value produces "'::text'" as value (#210)
Browse files Browse the repository at this point in the history
Co-authored-by: Artem Lobanov <artem.lobanov@vk.team>
  • Loading branch information
artlo and Artem Lobanov committed Oct 8, 2023
1 parent 1eba307 commit b04900e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ func (m Migrator) ColumnTypes(value interface{}) (columnTypes []gorm.ColumnType,
}

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

if datetimePrecision.Valid {
Expand Down

0 comments on commit b04900e

Please sign in to comment.