I put my rates in with a stack of decimal points, because accuracy matters!
But when I manually calculated the outputted costs associated with each transaction, I seemed to have some rounding errors.
So what was the issue?
The schema in MySQL was set to DECIMAL(10,4) which gives us 10 digits after the decimal point and 4 digits after.
A quick alter table and a reimport of the rates and I was on my way!
"alter table tp_rates modify column rate DECIMAL(10,10);"
Lesson learned and hopefully of use to any other CGrateS users who may be using MySQL as a StoreDB.
Other posts in the CGrateS in Baby Steps series:
- CGrateS Part 1 – Basics of CGrateS
- CGrateS in Baby Steps – Part 2 – Adding Rates and Destinations through the API
- CGrateS in Baby Steps – Part 3 – RatingProfiles & RatingPlans
- CGrateS in Baby Steps – Part 4 – Rating Calls
- CGrateS in Baby Steps – Part 5 – Events, Agents & Subsystems
- All the other posts tagged with CGrateS including SessionS, Attributes, Accounts & Balances, Actions & Action Plans, ActionTriggers, FilterS, StatS, Event Reader, CDR Export.
SQL query:
alter table tp_rates modify column rate DECIMAL(10,10)
MySQL said:
#1264 – Out of range value for column ‘rate’ at row 1