volatiletech / sqlboiler

Generate a Go ORM tailored to your database schema.
BSD 3-Clause "New" or "Revised" License
6.73k stars 544 forks source link

SQLBoiler doesn't correctly handle decimal and numeric values from MySQL #261

Closed damendes closed 6 years ago

damendes commented 6 years ago

I am using the version v2.6.0, and when I tested the generated the SQLBoiler template, I got many MySQL 1366 errors (Incorrect decimal value) from the output. Add "decimal" and "numeric" on lines 313 and 363 in the bdb/drivers/mysql.go file seems to solve this issue.

aarondl commented 6 years ago

This is actually in incorrect fix, and the real fix is coming with the v3 release: https://github.com/volatiletech/sqlboiler/issues/162

Be careful that you're not doing math with the resulting float64 as a result of your change, that would probably be undesirable if you chose decimal and numeric as your mysql data types. I'm going to close this as a duplicate, for the time being if you need these data types please work around it locally, sorry for not being able to deliver a more immediate solution.