The deleted customers' orders are still in
sales_flat_order only the customer_id is reset to NULL and orders set to archived. That means some of their info is still there.
Curiously after this accident happened literally during processing an order, Magento created the customer again with a new ID and the order went on like nothing was wrong. Thankfully (for me) I was working on a migration tool so I have a list of customer_ids with email, name, and their original password hash. Working out the steps to manually add them now.
Edited to add: I have accomplished as much as a repair as I deem practical for now.
- Got list of customers from the Xfer database whose IDs were up to 1053 (the lowest number remaining in the customer list).
- Used Mage::getModel() and $customer to add the deleted customer back to Magento 1.
- Got the new customer id from the newly added customer so I can match to the old customer ID from the Xfer database.
- Updated customer_entity to fix created_at, the website_id, and store_id.
- Updated sales_flat_order to set the customer_id where the email matches the one from the Xfer database.
- Updated sales_flat_invoice to find the previous customer ID and change to the new customer ID.
- Inserted the password hash from the Xfer database back into customer_entity_varchar.
- The customers reappear on the manage customers list, only now at the top.
- Previous sales appear in "purchases".
- The "orders" tab is blank. Not exactly sure how that tab is populated and not going to pore over the code unless people complain.
- You'll need to manually make a query to update the website and store IDs. The create customer Mage call I used ignored what I put in.
- Created_at is broken, but it's not exactly awesome anywhere in our Magento.