Unique check of coupon number is not concurrently safe
The unique check is done by query so concurrent transaction may create at the same time the same number.
We must lock the table before performing the check.
The unique check is done by query so concurrent transaction may create at the same time the same number.
We must lock the table before performing the check.