Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Error in file:  on upgrade from 1.4.1 to 1.4.2
 
kat1
Jr. Member
 
Total Posts:  10
Joined:  2008-08-14
 

I’m trying to upgrade a development site using Magento Connect.  The process seems to run OK but on completion the site thows the following error.  Any ideas how to safely resolve this?

Error in file"/var/www/vhosts/mydomain.com/httpdocs/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.7-1.4.0.0.8.php" SQLSTATE[42S01]Base table or view already exists1050 Table 'customer_form_attribute' already exists

Trace
:
#0 /var/www/vhosts/mydomain.com/httpdocs/app/code/core/Mage/Core/Model/Resource/Setup.php(390): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /var/www/vhosts/mydomain.com/httpdocs/app/code/core/Mage/Core/Model/Resource/Setup.php(289): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '1.4.0.0.7', '1.4.0.0.13')
#2 /var/www/vhosts/mydomain.com/httpdocs/app/code/core/Mage/Core/Model/Resource/Setup.php(233): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('1.4.0.0.7', '1.4.0.0.13')
#3 /var/www/vhosts/mydomain.com/httpdocs/app/code/core/Mage/Core/Model/Resource/Setup.php(161): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /var/www/vhosts/mydomain.com/httpdocs/app/code/core/Mage/Core/Model/App.php(363): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /var/www/vhosts/mydomain.com/httpdocs/app/code/core/Mage/Core/Model/App.php(295): Mage_Core_Model_App->_initModules()
#6 /var/www/vhosts/mydomain.com/httpdocs/app/Mage.php(596): Mage_Core_Model_App->run(Array)
#7 /var/www/vhosts/mydomain.com/httpdocs/index.php(78): Mage::run('', 'store')
#8 {main}
 
Magento Community Magento Community
Magento Community
Magento Community
 
phiber9
Member
 
Avatar
Total Posts:  41
Joined:  2010-05-26
Croatia
 

Refresh Magento cache.
Seems to worked for this guy: http://www.magentocommerce.com/boards/viewthread/213399/

 
Magento Community Magento Community
Magento Community
Magento Community
 
kat1
Jr. Member
 
Total Posts:  10
Joined:  2008-08-14
 

Tried clearing cache as suggested by deleting all files in:

/var/cache
/var/session

However, still have exactly the same issue it seems not to be effected by the cache.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kat1
Jr. Member
 
Total Posts:  10
Joined:  2008-08-14
 

Looking further at what is going on here it seems to be related to this issue:

http://www.magentocommerce.com/boards/viewthread/17670/

There are a whole load of mysql4-upgrade files (literally hundreds in various folders /app/code/core/Mage/????/sql/ etc.) that seem to be trying to add tables to the database that already exist.  Deleting the files removes the errors and gets further through the process but it would be great to know what it triggering these files to run in the first place.  The post above says they are not needed but whay are they there and what are the consequences of removing them?

Would be great to understand why I am having this issue.

 
Magento Community Magento Community
Magento Community
Magento Community
 
phiber9
Member
 
Avatar
Total Posts:  41
Joined:  2010-05-26
Croatia
 

First of all I would advise you not to delete any core files.

Do you have sample data in your database?

 
Magento Community Magento Community
Magento Community
Magento Community
 
kat1
Jr. Member
 
Total Posts:  10
Joined:  2008-08-14
 

I have backed up the files first. grin

There is no official sample data but the site has been under development for a number of months and does contain products, test orders etc.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ladle
Sr. Member
 
Avatar
Total Posts:  173
Joined:  2009-06-11
 

Any time I’ve had this error it is from trying to upgrade more than once.

You can try making a db backup, dropping the table mentioned completely, and rerun the upgrade.  I think that table is included with this upgrade, and it seems you had a partial upgrade that already added the table.

 
Magento Community Magento Community
Magento Community
Magento Community
 
buzbuzzer
Jr. Member
 
Total Posts:  29
Joined:  2008-11-24
 

How did you delete cache? Delete var/cache/* and var/session/* i would recommend by SSH, make sure there is NOTHING in the folders after deleting.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kat1
Jr. Member
 
Total Posts:  10
Joined:  2008-08-14
 

I’ve now spent a lot more hours on this although not a lot further forward.

I think ladle may be right that there has previously been an unsuccessful upgrade although I think the problem might stem from a past upgrade rather than this one.  I have successfully restored from my working 1.4.1 backup and everytime I attempt to go to 1.4.2 I get the same errors.

I have set up the site on a development server with a clean install of 1.4.2 which works fine. I then update app/etc/local.xml to connect to a copy of the original database then the fun begins:

The install process starts again, I add the original database details and press on, then the errors start:

Error in file: “/var/www/vhosts/www.mydomain.com/httpdocs/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php” - SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘sales_flat_order’ already exists

I try to get around this by dropping the table…

Error in file: “/var/www/vhosts/www.mydomain.com/httpdocs/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php” - SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘sales_flat_order_grid’ already exists

Drop table…

Error in file: “/var/www/vhosts/www.mydomain.com/httpdocs/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php” - SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘sales_flat_order’ already exists

Drop table…

Error in file: “/var/www/vhosts/www.mydomain.com/httpdocs/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php” - SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘sales_flat_order_address’ already exists

Drop table + also table sales_flat_order which has now reinstalled itself

Error in file: “/var/www/vhosts/www.mydomain.com/httpdocs/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php” - SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘sales_flat_order_grid’ already exists

Drop table + also table sales_flat_order which has now reinstalled itself again

Error in file: “/var/www/vhosts/www.mydomain.com/httpdocs/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php” - SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘sales_flat_order_status_history’ already exists

In despair try to delete all tables starting sales_flat_order.. and get mysql error message:

#1217 - Cannot delete or update a parent row: a foreign key constraint fails

Try again and have now moved onto errors in sales_flat_shipment tables…

Error in file: “/var/www/vhosts/www.mydomain.com/httpdocs/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php” - SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘sales_flat_shipment’ already exists

I imagine this could go on forever.

There must be a flag somewhere in this database that tells the installer that it needs to reinstall these tables.  If I new where it was then presumably it could be altered to allow the site to run?  Or is this an overly simplistic view?

Any one have any clue how to go forward here?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ladle
Sr. Member
 
Avatar
Total Posts:  173
Joined:  2009-06-11
 

You can try going into your core_resources table.  That’s where Magento knows whether to rerun an installer or not.  You can check if the sales_setup and salesrule_setup are there.  They probably are, and are probably older versions.

This is more useful if an installer is not working.  You kind of have the opposite scenario I think.

You might need to just keep doing what your doing, until you get to the end…

 
Magento Community Magento Community
Magento Community
Magento Community
 
slangsc
Jr. Member
 
Total Posts:  2
Joined:  2009-07-08
 

Same errors for me when trying to upgrade.  The table already exists, and I’m not sure which version put it there.  If I remove the table then the error changes to “cannot create table” instead of “table already exists”.  It baffles me because it should have the correct permissions to create the table again.  Any progress stepping through the individual install scripts?

 
Magento Community Magento Community
Magento Community
Magento Community
 
kat1
Jr. Member
 
Total Posts:  10
Joined:  2008-08-14
 

I got a bit further on and then ultimately had to give up and start again with a clean install.

I took a look at the core_resources table as suggested by ladie made the resource_version and data_version match the latest version numbers (as in clean 1.4.2 install) in the tables for sales_setup, customer_setup, paypal_setup and tag_setup (these were the only ones causing errors).  This got me through the errors on setup.

Everything looked good until I tried to add something to the cart where I got the white screen of death and no error messages.

Had to conclude that the site was properly broken and start again.  Luckily we were in late stages of development and not live so nothing two or three days configuration and product migration won\’t fix.

The worrying bit here is that the problem may have been caused by a previous upgrade through Connect that stalled, ultimately worked but then left this time bomb waiting for subsequent upgrades.  As noted above restoring to backups immediately before the 1.4.2 upgrade had no effect and the problem seemed unavoidable.

Think I\’ll stick to ssh for upgrades in future.

 
Magento Community Magento Community
Magento Community
Magento Community
 
guillaume7684
Sr. Member
 
Total Posts:  241
Joined:  2008-10-20
 
slangsc - 26 December 2010 03:52 PM

Same errors for me when trying to upgrade.  The table already exists, and I’m not sure which version put it there.  If I remove the table then the error changes to “cannot create table” instead of “table already exists”.  It baffles me because it should have the correct permissions to create the table again.  Any progress stepping through the individual install scripts?

slangsc - 26 December 2010 03:52 PM

Same errors for me when trying to upgrade.  The table already exists, and I’m not sure which version put it there.  If I remove the table then the error changes to “cannot create table” instead of “table already exists”.  It baffles me because it should have the correct permissions to create the table again.  Any progress stepping through the individual install scripts?

Hello,

I have the same problem as yours.
SQLSTATE[HY000]: General error: 1005 Can’t create table ‘./BDD_dev/customer_form_attribute.frm’

When I go to the backoffice, I have this error message:

Exception printing is disabled by default for security reasons.

The message on the report is:

a:5:{i:0;s:247:"Error in file: "/home/xxxxx/www/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 './BDD_dev/customer_form_attribute.frm' (errno: 150)";i:1;s:1036:"#0 /home/xxxxx/www/app/code/core/Mage/Core/Model/Resource/Setup.php(390): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /home/xxxxx/www/app/code/core/Mage/Core/Model/Resource/Setup.php(289): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '1.4.0.0.7', '1.4.0.0.13')
#2 /home/xxxxx/www/app/code/core/Mage/Core/Model/Resource/Setup.php(233): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('1.4.0.0.7', '1.4.0.0.13')
#3 /home/xxxxx/www/app/code/core/Mage/Core/Model/Resource/Setup.php(161): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /home/xxxxx/www/app/code/core/Mage/Core/Model/App.php(363): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /home/xxxxx/www/app/code/core/Mage/Core/Model/App.php(295): Mage_Core_Model_App->_initModules()
#6 /home/xxxxx/www/app/Mage.php(596): Mage_Core_Model_App->run(Array)
#7 /home/xxxxx/www/index.php(78): Mage::run('', 'store')
#8 {main}"
;s:3:"url";s:6:"/admin";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}

In my BDD_dev there is no table: customer_form_attribute.frm

Thank you to help me, and explain me why it doesn’t create this table in my BDD.

 
Magento Community Magento Community
Magento Community
Magento Community
 
buzbuzzer
Jr. Member
 
Total Posts:  29
Joined:  2008-11-24
 

So I ran into this error myself going from 1.4.2 to 1.5.0.1...so i had a pretty clean install and noticed this and one other table after this had no values at all, so in the database i simply removed the tables which were replaced when this script ran again.  not that this is the best solution and it might not work for you (especially if you have values in the table) but it did the trick for me.

Avoiding this problem is basically not completing your installation, so if you can’t debug it and continue the install process, I recommend you revert to your backup.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Crucial
Enthusiast
 
Avatar
Total Posts:  770
Joined:  2007-11-07
Phoenix, AZ
 

The only way to get around this is to dump your existing database before upgrading, deleting and then recreating a new database (or completely emptying the existing one that you took a dump of), then importing the dump back. Then you can proceed with the upgrade and you won’t get these errors.

 
Magento Community Magento Community
Magento Community
Magento Community
 
IGeeky1
Jr. Member
 
Total Posts:  20
Joined:  2010-02-26
 

I’m having the same problem going from 1.4 to 1.5

I made a backup of my production db
created a new db for 1.5
set up a fresh 1.5 install on a new directory
imported backup into db

as far as I can tell this is what Crucial is referring to in order to avoid this problem

got into both front end and backend just fine
then regreshed cache and ...boom got the customer_form_attribute already exists
dropped it from db and got this

Error in file: “/var/www/html/magento/app/code/core/Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.7-1.4.0.0.8.php” - SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘customer_form_attribute’ already exists
Trace:
#0 /var/www/html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(390): Mage::exception(’Mage_Core’, ‘Error in file: ...’)
#1 /var/www/html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(289): Mage_Core_Model_Resource_Setup->_modifyResourceDb(’upgrade’, ‘1.4.0.0.7’, ‘1.4.0.0.13’)
#2 /var/www/html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(233): Mage_Core_Model_Resource_Setup->_upgradeResourceDb(’1.4.0.0.7’, ‘1.4.0.0.13’)
#3 /var/www/html/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(161): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /var/www/html/magento/app/code/core/Mage/Core/Model/App.php(399): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /var/www/html/magento/app/code/core/Mage/Core/Model/App.php(329): Mage_Core_Model_App->_initModules()
#6 /var/www/html/magento/app/Mage.php(627): Mage_Core_Model_App->run(Array)
#7 /var/www/html/magento/index.php(80): Mage::run(’’, ‘store’)
#8 {main}

as a prequal in going from 1.4.1 to 1.4.2 I had a partial upgrade problem using Connect

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2