After running the migration I find myself unable to place orders.
After some digging the error that is thrown is the one in the title:
SQLSTATE: Integrity constraint violation: 1062 Duplicate entry '100019997-1' for key 'SALES_ORDER_INCREMENT_ID_STORE_ID
sales_order there is
increment_id value. My highest value is 100032938 but when the orderRepository saves the new order somehow 100019997 is generated. Now I have an order that already has that value and the
increment_id column is an index which means unique values.
Deleting the existing order is not an option nor is truncating the
My question is how does Magento come up with this value 100019997.
I know that the first digit is he store id and I found information that the other number
199997 is taken from
sequence_order_1 table and the zeros are added by some formula. In the
sequence_order_1 I have a value that is in the thirty thousands.
I've also tried. Cache cleaning and reindexing.
How can I make Magento or the DB (depending of who is responsible) to generate a valid increment_id when placing orders?
Any tips or pointers are appreciated. Thanks
PS: I've tried this with no success
- Open MySQL database of your Magento 2 store with the help of phpMyAdmin.
- Find the 'sequence_order_1' table . Note, that this table is located in the database itself, not in the 'information_schema'.
- Hit the 'Operations' tab and edit the necessary 'increment_id' number under it.