Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.5.4 breaks generated jsonb default value for postgres #225

Open
ilyadh opened this issue Nov 21, 2023 · 0 comments
Open

v1.5.4 breaks generated jsonb default value for postgres #225

ilyadh opened this issue Nov 21, 2023 · 0 comments
Assignees

Comments

@ilyadh
Copy link

ilyadh commented Nov 21, 2023

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.

// 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants