Last active
June 4, 2018 13:52
-
-
Save janssens/009d2988c4b6da1f53d08f070043a327 to your computer and use it in GitHub Desktop.
Magento sql script to regenerate eav_entity_store table.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TRUNCATE eav_entity_store; | |
INSERT INTO eav_entity_store (entity_type_id,store_id,increment_prefix,increment_last_id) | |
SELECT | |
'5' AS entity_type_id, | |
store_id AS store_id, | |
store_id AS increment_prefix, | |
increment_last_id AS increment_last_id | |
FROM (SELECT store_id as store_id, MAX(increment_id) as increment_last_id FROM sales_flat_order WHERE store_id is not NULL GROUP BY store_id) as tmp; | |
INSERT INTO eav_entity_store (entity_type_id,store_id,increment_prefix,increment_last_id) | |
SELECT | |
'6' AS entity_type_id, | |
store_id AS store_id, | |
store_id AS increment_prefix, | |
increment_last_id AS increment_last_id | |
FROM (SELECT store_id as store_id, MAX(increment_id) as increment_last_id FROM sales_flat_invoice WHERE store_id is not NULL GROUP BY store_id) as tmp; | |
INSERT INTO eav_entity_store (entity_type_id,store_id,increment_prefix,increment_last_id) | |
SELECT | |
'7' AS entity_type_id, | |
store_id AS store_id, | |
store_id AS increment_prefix, | |
increment_last_id AS increment_last_id | |
FROM (SELECT store_id as store_id, MAX(increment_id) as increment_last_id FROM sales_flat_creditmemo WHERE store_id is not NULL GROUP BY store_id) as tmp; | |
INSERT INTO eav_entity_store (entity_type_id,store_id,increment_prefix,increment_last_id) | |
SELECT | |
'8' AS entity_type_id, | |
store_id AS store_id, | |
store_id AS increment_prefix, | |
increment_last_id AS increment_last_id | |
FROM (SELECT store_id as store_id, MAX(increment_id) as increment_last_id FROM sales_flat_shipment WHERE store_id is not NULL GROUP BY store_id) as tmp; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment