During an upgrade from Magento 1.5 to 1.7 unfortunately we had to reinstall Magento (don't ask) and now I need to get all of the old order information into the live upgrade. I've researched several scenarios. First would be identifying the tables in the database they correspond to and migrating those tables over, but I have three issues with that. One: I already did a little bit of that and because of the discrepancies between 1.5 and 1.7 caused several hours of debugging fun. Two: I can't figure out specifically which of these freaking tables needs updating (was going to just replace all sales_ tables). Third: since the upgrade other orders have been placed, and as you know, started order ids all over again and I don't want those entries to get replaced.
My other choice is to attempt to build an extension like this one: http://www.magentocommerce.com/magento-connect/dataflow-batch-import-export-orders-to-csv-xml.html. I already started but alas am already stuck on the oAuth process.
Before I waste anymore time, I'd like some advice. What would be the best way to go about this process?
Update 1-17
I have tried UNION queries on applicable tables but of course I get error "#1062 - Duplicate entry '1' for key 'PRIMARY'" being there are several primary keys. Is there a query to increment those primary keys of the new orders to follow after the ids of the old orders? I tried to do this in individual columns via UPDATE sales_flat_invoice_grid
SET increment_id
= (increment_id
+6150) or similar, but the ids are mapped to the ids on other tables! Please help! I'm afraid I'm going to have to tell boss that we need to buy that extension.