# Problems with SQL Upgrade scripts on EE at a multi majore version upgrade

We are currently having a strange problem with an upgrade from Magento PE v 1.10.0.1 to Magento EE v 1.12.0.2. Can anyone give us some ideas who has expertise and experience in Magento Upgrades?

The problem we are facing is basically that no changes are being made to they system during the upgrade, which never ends. We have tried 2 methods. First we copied the EE code our system and accessed the website to launch the upgrade. Secondly we to tried to reference our system's database from the local.xml of a Magento EE and accessing the EE to initiate a database upgrade. In both cases no changes were made to the database (we have been monitoring the core_resource table for updates).

This is a large system with around 8,000 products and 12 store views, but we also made sure that all the indexes were up to date before starting the upgrade.

UPDATE:

The clue was that it was a large system...

By debugging the code we were able to locate the source of the problem : the first upgrade script to be executed was modifying the core_url_rewrite table which had more than half a million records in it.

After truncating the table to allow the upgrade to continue, we started getting random errors in this form:

> a:5:{i:0;s:317:"Error in file:
> - SQLSTATE[HY000]: General error: 1025 Error on rename of '.\therugcompany@002dfinal\catalog_product_entity_varchar' to
> '.\therugcompany@002dfinal\#sql2-7338-5' (errno: 152)";i:1;s:1158:"#0
> C:\Development\Magento\Enterprise\xxRugCompany\app\code\core\Mage\Core\Model\Resource\Setup.php(645):
> Mage::exception('Mage_Core', 'Error in file: ...')
> #1 C:\Development\Magento\Enterprise\xxRugCompany\app\code\core\Mage\Core\Model\Resource\Setup.php(437):
> '1.4.0.0.44', '1.6.0.0.14')
> #2 C:\Development\Magento\Enterprise\xxRugCompany\app\code\core\Mage\Core\Model\Resource\Setup.php(320):
> '1.6.0.0.14')
> #3 C:\Development\Magento\Enterprise\xxRugCompany\app\code\core\Mage\Core\Model\Resource\Setup.php(235):
> #4 C:\Development\Magento\Enterprise\xxRugCompany\app\code\core\Mage\Core\Model\App.php(417):
> #5 C:\Development\Magento\Enterprise\xxRugCompany\app\code\core\Mage\Core\Model\App.php(343):
> Mage_Core_Model_App->_initModules()
> #6 C:\Development\Magento\Enterprise\xxRugCompany\app\Mage.php(683): Mage_Core_Model_App->run(Array)
> #7 C:\Development\Magento\Enterprise\xxRugCompany\index.php(78): Mage::run('', 'store')
> #8 {main}";s:3:"url";s:1:"/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}


Checked out the web for answers and apparently its something to to with foreign key constraints. We already have:

<initStatements><![CDATA[SET NAMES utf8; SET FOREIGN_KEY_CHECKS = 0; SET UNIQUE_CHECKS = 0;]]></initStatements>


set in our local.xml though. Any ideas?

WHY ON EARTH is your database connection being initialized with foreign key checks off?

This is almost certainly the cause of the errors you are seeing. This should never have been done, and your data is, unfortunately, likely hosed. Unless I'm mistaken.

The jump from 1.10 to 1.12 is a fairly large one. From past experience, it is best to do a systematic upgrade, thus 1.10 -> 1.11 -> 1.12

It can also be beneficial to systematically upgrade between the minor version as well.

With each upgrade 'stage' done, you can evaluate the site, and solve any issues, before you proceed to the next.

Yes takes a while, but gives best results.

For the stages, use any upgrade patch files from magento, if available, rather than just copying the base source from the next version.

If your site is under version control, you can then also see what files were adjusted by each upgrade patch via diffs, which can be a great help.

Also make sure any 3rd party modules get upgraded along the way, as some may not work with newer versions of magento.

and, make sure cache is disabled before you start ;)