Database Orders: Generate order numbers in the database #1030
duncanmcclean
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Right now, order numbers are generated by Simple Commerce before saving orders:
https://github.com/duncanmcclean/simple-commerce/blob/6.x/src/Orders/EloquentOrderRepository.php#L275-L288
However, if you have a busy site, you could potentially end up in a scenario where two users attempt to create an order at the exact same time and it'd error out due to duplicate order numbers.
For example...
Integrity constraint violation: 1062 Duplicate entry '1020' for key 'orders.orders_order_number_unique'
Ideally, for sites storing orders in the database, it would be great if we could push off the generation of the order numbers to the database so we don't need to deal with it in SC.
However, I need to do some further research into how we'd do that and if the same approach would work for all database engines, like SQLite.
Beta Was this translation helpful? Give feedback.
All reactions