steveosoule
4/29/2015 - 7:02 PM

Miva - Database Table Migration StoreKey Queries

Miva - Database Table Migration StoreKey Queries

---
--- Module IDs
--- Run these queries on the new site after the tables have been copied over
---

UPDATE s01_OrderCharges SET module_id=122 WHERE module_id=118; # 10131 rows affected when imported on 2014-09-18
UPDATE s01_OrderCharges SET module_id=163 WHERE module_id=171; # 19900 rows affected when imported on 2014-09-18
UPDATE s01_OrderCharges SET module_id=184 WHERE module_id=179; # 9755 rows affected when imported on 2014-09-18

UPDATE s01_OrderPayments SET pay_id=107 WHERE pay_id=102; # 19883 rows affected when imported on 2014-09-18

UPDATE s01_Orders SET ship_id=122 WHERE ship_id=118; # 10129 rows affected when imported on 2014-09-18
UPDATE s01_Orders SET ship_id=184 WHERE ship_id=179; # 9754 rows affected when imported on 2014-09-18

---
--- Store keys
--- Run these to update the new site's Store Keys to the proper values
---

UPDATE s01_StoreKeys SET maxvalue=(SELECT id FROM s01_Customers ORDER BY id DESC LIMIT 1) WHERE type='Customers' LIMIT 1
UPDATE s01_StoreKeys SET maxvalue=(SELECT id FROM s01_OrderPayments ORDER BY id DESC LIMIT 1) WHERE type='OrderPayments' LIMIT 1
UPDATE s01_StoreKeys SET maxvalue=(SELECT id FROM s01_Orders ORDER BY id DESC LIMIT 1) WHERE type='Orders' LIMIT 1
UPDATE s01_StoreKeys SET maxvalue=(SELECT id FROM s01_OrderShipments ORDER BY id DESC LIMIT 1) WHERE type='OrderShipments' LIMIT 1
UPDATE s01_StoreKeys SET maxvalue=(SELECT line_id FROM s01_SS_REGISTRY_regprod ORDER BY line_id DESC LIMIT 1) WHERE type='SS_Registry' LIMIT 1