I am currently working on a new website design and planning to upgrade our current shop. The main bases will be the old database, but on "moving day" I want to import the latest orders/stock values and /sales/customers into the new database.

I was thinking of just importing the tables(customer_*/sales_*/cataloginventory_*), or does this not work? If so, which tables need to be moved?

My first test failed with the following:

ERROR 1217 (23000) at line 29: Cannot delete or update a parent row: a foreign key constraint fails

  • Depends on what major changes are made to those tables between 1.7 and 1.9. First step would be to do a database structure dump of 1.7 and one of 1.9 and compare all fields, keys and fk constraints to see if they're even compatible. Then on top of that is the EAV dataspray and how it affects all those foreign key constraints. Sep 23, 2014 at 22:47
  • Why would you import and not just upgrade the database? Sep 24, 2014 at 18:03
  • 1
    @brentwpeterson Precisely... Any other way is the path of excessive pain. Magento database upgrade is painful enough as is at times without finding new ways of experiencing it. Sep 28, 2014 at 17:24
  • 1
    Isn't it better to just let the code point to the new database? The code will upgrade the database by upgrade scripts. No need to migrate a database...
    – 7ochem
    Mar 4, 2015 at 15:05

1 Answer 1


Exporting and reimporting orders, products, etc from Magento is a difficult and tedious task. Magento uses a heavily normalized (flexible) database schema which can make working with the database directly very difficult and inadvisable if you aren't sure of what you're doing.

During an upgrade you're expected to keep the same database; Magento's setup scripts will upgrade and alter the database as-needed which preserving or transforming the data for compatibility.

As with any major change you should be sure to have a complete and working backup of the database before you kick off the upgrade. There's no guarantee the database changes made during the 1.9 upgrade will be backwards compatible, so if you have to rollback to 1.7 then you will quite possibly need to rollback the database as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.