go-gorm / go-gorm/postgres

v1.5.4 breaks generated jsonb default value for postgres

Open
#225 0 comments 0 reactions 1 assignee Claimed by @jinzhu View on GitHub
Dominant language
Go
Stars
297
Forks
155
Avg merge
27m
Merged PRs (30d)
2

Description

## Description

I'm using gorm.io/gen to generate models from schema. Driver update from v1.5.3 to v1.5.4 changed the way default value for jsonb is generated.

```go
// v1.5.3
type MyModel struct {
Data datatypes.JSON `gorm:"column:data;type:jsonb;default:'{}'" json:"data"`
}

// v1.5.4
type MyModel struct {
Data datatypes.JSON `gorm:"column:data;type:jsonb;default:{}" json:"data"`
}
```
(datatypes.JSON is my customization with DataTypeMap)

Now when running `AutoMigrate` I get the following error:
```
Error migrating the database: ERROR: syntax error at or near "{" (SQLSTATE 42601)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.