-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Edge case - increase limits of monetary columns #838
Comments
Throwing in support of this feature request. In addition to countries with high denomination currencies, B2B e-commerce often involves higher priced goods. Edit: |
Thanks @mattgills for your input on this. Then I guess we'd only be limited by JavaScript's |
I would lean towards keeping the integer math, as that has been reliable, and that reliability has been important with respect to financial calculations. A few things that may be helpful with
As for GraphQL, a custom Scalar seems like the right approach. I would think creating it from scratch in Vendure would be better than leveraging 3rd party packages, like apollo-type-bigint (not sure how active that is - last commit was 2019). Regardless, there is interesting things to take from that repo, such as the differentiation between |
There is also this scalar: |
@badrange thanks! yeah I've been experimenting with that - we already have the |
Is your feature request related to a problem? Please describe.
The limit for monetary fields (cart sum, order sum, product variant price) is now (2^31-1)/100 =
21 474 836,47
This limit can be not enough for countries with high denomination currencies.
Describe the solution you'd like
Limit appears from TypeORM data type
Number
. It is considered asint
with corresponding limit in node.js and selected DB.Quick research shows, that there are couple of approaches:
Using bigint
It's solid approach, but Typeorm consider bigint as string, so many modifications should be done at the Vendure sideUsing decimal(15,4) or even bigger
Also solid approach, but it requires using accurate data type and math operations at the Vendure side.Describe alternatives you've considered
Continue using
int
. But there will still exist problems with overflowing.The text was updated successfully, but these errors were encountered: