You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a way to override the return value of Dialector.DefaultValueOf()
Motivation
For our project we use sqlite driver for the tests.
When we insert a default value with gorm:default:null it inserts DEFAULT instead of NULL. The field is a primary key and has AutoIncrement disabled because we are using snowflake.
We couldn't find any solution except by modifying the driver code which is not satisfying
The text was updated successfully, but these errors were encountered:
if field.HasDefaultValue {
return clause.Expr{SQL: field.DefaultValue}
}
before returning "DEFAULT". I have done this by reimplementing the Dialector interface in my project, which calls the sqlite.Dialector interface functions except with this small override before calling sqlite.DefaultValueOf()
It would be more efficient if this small change would be included upstream.
Thank you!
Describe the feature
Add a way to override the return value of Dialector.DefaultValueOf()
Motivation
For our project we use sqlite driver for the tests.
When we insert a default value with
gorm:default:null
it inserts DEFAULT instead of NULL. The field is a primary key and has AutoIncrement disabled because we are using snowflake.We couldn't find any solution except by modifying the driver code which is not satisfying
The text was updated successfully, but these errors were encountered: