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
Can't edit any object : Error 1292: Incorrect datetime value: '0000-00-00' for column 'created_at' at row 1 #122
Comments
|
I think it is the same problem with |
|
So GORM doesn't work with MySQL >= 5.7? |
|
No, GORM can work with MySQL 5.7 , but must disable the NO_ZERO_DATE in your sql mode. |
|
Just tested GORM and didn't see this issue (date should in fact not be 0000-00-00, probably only happens if you set it like that manually). Note that you must add |
|
I have same issue with ❯ mysql -V
mysql Ver 8.0.13 for osx10.14 on x86_64 (Homebrew) |
|
What is the proper solution to this? I'm having issues with MySQL 8, GORM is not autogenerating fields that it should be ( My base model: type Base struct {
ID uuid.UUID `gorm:"primary_key" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `gorm:"index" json:"updated_at"`
DeletedAt *time.Time `gorm:"index" json:"deleted_at"`
}My connection url/string I'm using: |
|
I've also had the same issue with timestamp fields. Try adding i.e: |
|
I tried but no luck. Getting the same error. |
|
I get the same error too. |
|
I get the same error, also with |
|
I found a workaround by wrapping your object inside an array. i.e: This will resulted in SQL: and will fail with error as created_at is 0000-00-00. This will produce SQL: |
|
No veo ninguna solución aquí. |
Hello.
When trying to edit any gorm object, I am getting this error :
There is an example of GORM model and the related configuration :
Any idea of how can I fix this ? This field is part of the fields automatically generated by GORM through the gorm.Model, there is the failing query:
Thanks
The text was updated successfully, but these errors were encountered: