Magento 2 uses table sales_sequence_meta and sales_sequence_profile for defining the entity prefix for stores.
If 2 and 3 are the store_id of two store views of the same website, the table data may look like this
mysql> SELECT * FROM sales_sequence_meta WHERE entity_type='order' AND store_id IN (2, 3);
+---------+-------------+----------+-------------------+
| meta_id | entity_type | store_id | sequence_table |
+---------+-------------+----------+-------------------+
| 11 | order | 2 | sequence_order_2 |
| 12 | order | 3 | sequence_order_3 |
+---------+-------------+----------+-------------------+
And sales_sequence_profile table looks like
mysql> SELECT * FROM sales_sequence_profile WHERE meta_id IN (11, 12);
+------------+---------+--------+--------+-------------+------+------------+---------------+-----------+
| profile_id | meta_id | prefix | suffix | start_value | step | max_value | warning_value | is_active |
+------------+---------+--------+--------+-------------+------+------------+---------------+-----------+
| 11 | 11 | 2 | | 1 | 1 | 4294967295 | 4294966295 | 1 |
| 12 | 12 | 3 | | 1 | 1 | 4294967295 | 4294966295 | 1 |
+------------+---------+--------+--------+-------------+------+------------+---------------+-----------+
With these, the generated order numbers may look like 2000000001 … and 3000000001… for stores with id 2 and 3 respectively.
But I want the same sequence 200000000x (2 as the prefix) for orders from store_id = 3 as well.
From looking at table, I guess I can easily update as:
UPDATE sales_sequence_meta SET sequence_table = 'sequence_order_2' WHERE entity_type='order' AND store_id = 3;
UPDATE sales_sequence_profile SET prefix = '2' WHERE profile_id = 12;
But not sure if it’s the correct way to do it.
Please share your views on this if you have any hands-on experience.