Recently I added an english store view to my store in Magento 1.9.2.2.
Italian store view is 1.
English store view id is 2.
When I tried to create an order paying with PayPal i got an error like this:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '200000001' for key 'UNQ_SALES_FLAT_INVOICE_INCREMENT_ID', query was: INSERT INTO `sales_flat_invoice` (`store_id`, `base_grand_total`, `shipping_tax_amount`, `tax_amount`, `base_tax_amount`, `store_to_order_rate`, `base_shipping_tax_amount`, `base_discount_amount`, `base_to_order_rate`, `grand_total`, `shipping_amount`, `subtotal_incl_tax`, `base_subtotal_incl_tax`, `store_to_base_rate`, `base_shipping_amount`, `total_qty`, `base_to_global_rate`, `subtotal`, `base_subtotal`, `discount_amount`, `billing_address_id`, `order_id`, `state`, `shipping_address_id`, `store_currency_code`, `transaction_id`, `order_currency_code`, `base_currency_code`, `global_currency_code`, `increment_id`, `created_at`, `updated_at`, `hidden_tax_amount`, `base_hidden_tax_amount`, `shipping_hidden_tax_amount`, `shipping_incl_tax`, `base_shipping_incl_tax`, `cod_tax_amount`, `base_cod_tax_amount`, `fooman_surcharge_amount`, `base_fooman_surcharge_tax_amount`, `base_fooman_surcharge_amount`, `fooman_surcharge_tax_amount`, `discount_description`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '2017-10-02 13:33:30', '2017-10-02 13:33:30', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
So I looked up in database and looks like there is no invoice entity_store_id for my new english store view.
SELECT * FROM eav_entity_store;
+-----------------+----------------+----------+------------------+-------------------+
| entity_store_id | entity_type_id | store_id | increment_prefix | increment_last_id |
+-----------------+----------------+----------+------------------+-------------------+
| 1 | 5 | 1 | 1 | 100006465 |
| 2 | 6 | 1 | 2 | 200001498 |
| 3 | 8 | 1 | 1 | 100000131 |
| 4 | 7 | 1 | 1 | 100000084 |
| 5 | 5 | 2 | 2 | 200000008 |
+-----------------+----------------+----------+------------------+-------------------+
5 rows in set (0.03 sec)
How is that possible? Should I just add it like this or it could create other problems?
INSERT INTO eav_entity_store (`entity_store_id` ,`entity_type_id` ,`store_id` ,`increment_prefix` ,`increment_last_id`) VALUES ('6', '6', '2', '1', '300000001');