Yeast attenuation is a percent, so I originally migrated the attenuation column as a decimal less than 1, e.g., "0.75" for 75%. However, the implementation of this turned out to be more of a headache than I imagined, so I began storing the attenuation as the percent (e.g., "75") straight from the form without first processing it into a decimal. I didn't make any additional migrations to account for this.
When adding recipes in Heroku, I encountered this error:
DETAIL: A field with precision 4, scale 3 must round to an absolute value less than 10^1.
It seems that the yeast attenuation, which currently has precision 4, scale 3, isn't working in Postgres because of it's stricter typing (whereas SQLite treats decimals like numerics).
The short term solution is to run a new migration that will change the precision to 4 and the scale to 2, e.g., "75.25", nothing higher than "99.99").
The long term solution, or more of a safeguard to prevent these from popping up after pushing to production, is to change the dev and test db's to Postgres.
Yeast attenuation is a percent, so I originally migrated the attenuation column as a decimal less than 1, e.g., "0.75" for 75%. However, the implementation of this turned out to be more of a headache than I imagined, so I began storing the attenuation as the percent (e.g., "75") straight from the form without first processing it into a decimal. I didn't make any additional migrations to account for this.
When adding recipes in Heroku, I encountered this error:
DETAIL: A field with precision 4, scale 3 must round to an absolute value less than 10^1.
It seems that the yeast attenuation, which currently has
precision 4, scale 3
, isn't working in Postgres because of it's stricter typing (whereas SQLite treatsdecimals
likenumerics
).The short term solution is to run a new migration that will change the
precision
to 4 and thescale
to 2, e.g., "75.25", nothing higher than "99.99").The long term solution, or more of a safeguard to prevent these from popping up after pushing to production, is to change the dev and test db's to Postgres.