Question

So, I'm upgrading a Magento install from 1.3.2.1 to 1.7.0.2. But I get the following error when I try to convert the database to the new format.

a:5:{i:0;s:239:"Error in file: "/home/user/public_html/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.7-1.4.0.0.8.php" - SQLSTATE[HY000]: General error: 1005 Can't create table 'user_new.customer_form_attribute' (errno: 150)";i:1;s:994:"#0 /home/user/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(645): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /home/user/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(437): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '1.4.0.0.7', '1.6.2.0.1')
#2 /home/user/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(320): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('1.4.0.0.7', '1.6.2.0.1')
#3 /home/user/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /home/user/public_html/app/code/core/Mage/Core/Model/App.php(417): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /home/user/public_html/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App->_initModules()
#6 /home/user/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#7 /home/user/public_html/index.php(87): Mage::run('', 'store')
#8 {main}";s:3:"url";s:1:"/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}

Anybody who have fixed this problem? Google don't give me any answers only people who have the same problem.

Was it helpful?

Solution

The tables in Magento 1.3 are MyISAM and later are converted to InnoDB. Now the 150 error message you are getting is related to FKs:

If MySQL reports an error number 1005 from a CREATE TABLE statement, and the error message refers to error 150, table creation failed because a foreign key constraint was not correctly formed. Similarly, if an ALTER TABLE fails and it refers to error 150, that means a foreign key definition would be incorrectly formed for the altered table. To display a detailed explanation of the most recent InnoDB foreign key error in the server, issue SHOW ENGINE INNODB STATUS.

Source

OTHER TIPS

It is a long way to upgrade Magento from 1.3.2.1 to 1.7.0.2. Errors are almost always happen. You didn't mentioned the way how you plan to upgrade, it plays a vital role in this question. Definitely, it is safer to move step by step 1.3 to 1.4 to 1.5 to 1.6 to 1.7.

Have you made a backup for you data? If yes, it is better to start it all from the very beginning.

Minor problems here are inevitable, especially, if you have really old version of Magento that you would like to upgrade.

Here is the standard procedure when getting Magento up to date. It is just for you to see, because you can select another way to update the store.

1) Know what are you facing with:

Check google if there is something special about upgrading your specific version of Magento to the newest one. If nothing else, you will be prepared with issues that you will need to solve.

2) Backup your files

We usually do it from CLI like this: tar -cvvzf your_site_directory.tar.gz your_site_directory/ 2>error.log

3) Backup your database

You can also do it from CLI like this:

mysqldump -u THIS_IS_YOUR_USERNAME_FOR_DB -h localhost -pTHIS_IS_YOUR_USERNAME_FOR_DB my_database_name | gzip -9 > my_database_name.sql.gz

4) Copy those files to the new location

In case you need to move files between 2 servers, easiest way I can think of in CLI would be this:

scp /path_to_some_file/your_site_directory.tar.gz user@REMOTE_SERVER_ADDRESS:/some_dir_on_remote_server You can do the same with your backup-ed database

5) Now it is time to import database into new created one:

a) Extract my_database_name.sql.gz

b) mysql –verbose –user=THIS_IS_YOUR_USERNAME –password=THIS_IS_YOUR_PASSWORD newly_created_db < my_database_name.sql

6) Now extract the files this way:

tar -xvvzf your_site_directory.tar.gz This will extract all files to the current directory

7) Edit db table core_config_data and set new secure/unsecure URLs of your site

8) Disable cache from admin.

9) Delete cache and session directories located here: /var/cache /var/session

rm /your_path_to/var/session -R rm /your_path_to/var/cache -R

10) Execute “clean” bash script located in /downloader/pearlib directory

a) Run chmod +x clean to be able to execute this script b) ./clean to execute script

11) Finally go to Magento connect manager from your Magento admin Paste this extension to upgrade Magento: magento-core/Mage_All_Latest After this is done, you should have new Magento, however if there was some custom coding, you should really know what is going on with your code.

12) All that left is to test it and move those files on production server.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top