Skip to content

Commit

Permalink
Fix get default value from database, close go-gorm/gorm#6543
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhu committed Aug 27, 2023
1 parent cac4aec commit 7ba909e
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\s]+$`).ReplaceAllString(column.DefaultValueValue.String, "$1")
column.DefaultValueValue.String = regexp.MustCompile(`'?(.*)\b?'?::[\w ]+$`).ReplaceAllString(column.DefaultValueValue.String, "$2")
}

if datetimePrecision.Valid {
Expand Down

0 comments on commit 7ba909e

Please sign in to comment.