Magento Forum

   
Weird Error : 1.2.1 to 1.5.1
 
MageClub
Guru
 
Avatar
Total Posts:  382
Joined:  2009-07-25
India
 

Ok, we might have done more than 170+ client website upgrades in this 2 years and never had any kind of issues.

This is the first time, we are stuck.

Ok here is the issue :

Current version is 1.2.1 .

We upgraded it in our fresh installation way and we had the same error.
So,we did it from the ssh and when tried to access the URL on browser, it says,

Error in file"/nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Log/sql/log_setup/mysql4-upgrade-0.7.4-0.7.5.php" SQLSTATE[42S01]Base table or view already exists1050 Table 'wm_log_visitor_online' already exists
Trace
:
#0 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Core/Model/Resource/Setup.php(292): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Core/Model/Resource/Setup.php(179): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '0.7.4', '0.7.6')
#2 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Core/Model/Resource/Setup.php(146): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('0.7.4', '0.7.6')
#3 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Core/Model/Resource/Setup.php(121): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Core/Model/Config.php(263): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Core/Model/App.php(263): Mage_Core_Model_Config->init(Array)
#6 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/Mage.php(434): Mage_Core_Model_App->init('', 'store', Array)
#7 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/Mage.php(455): Mage::app('', 'store', Array)
#8 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/index.php(65): Mage::run()
#9 {main}

NOTE : The table prefix is wm_

So, what can be the issue ?

And do you suggest any other way to handle this , like delete some db tables and get it right and then put it back , bla bla ?

Any idea ?
Let me know.

 
Magento Community Magento Community
Magento Community
Magento Community
 
UnderDogg
Member
 
Total Posts:  63
Joined:  2011-06-25
 

And do you suggest any other way to handle this , like delete some db tables and get it right and then put it back

The error means that the database table already exists and the upgrade wants to create it.
Let’s wait for some other responses, but I would indeed rename that single table and then retry the upgrade.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3215
Joined:  2009-02-26
Minneapolis MN
 

Greetings, the wm_ just means that you have chosen a prefix on your tables for your Magento install.

You are safe doing two things here, you can drop the table (Since this is populated as visitors use the site) or you can add a if exists statement to the SQL upgrade script and Magento will skip that.

Normally this happens when your installation stops for some reason.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageClub
Guru
 
Avatar
Total Posts:  382
Joined:  2009-07-25
India
 

OK I solved it.

1. Deleted that table.
2. Refreshed frontend. It gave another message and this kept on repeating for like 5-6 times.
3. Had to delete 5-6 tables. [wm_catalog_product_bundle_price_index was prompted once with error and I dropped that as well. Later it got created automatically.]
4. Then it came.
5. Went to the backend and refreshed cache and reindexed via ssh.

Now its good.

And right now, Im going to do the 1.3.2.4 to 1.5.1.0 .

Lets see, if it goes good.

Just one issue , MANAGE PRODUCTS page is blank . Not sure, why ?

Is there a way, I can debug it or get the error message, which is stopping it to come up ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageClub
Guru
 
Avatar
Total Posts:  382
Joined:  2009-07-25
India
 

OK I just upgraded it to 1.5.1.0 .

It started giving errors and I started dropping tables.

But its stuck on one place.

See below,

Error in file\"/nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.18-0.8.19.php\" SQLSTATE[42S02]Base table or view not found1146 Table \'db107651_wm.wm_core_email_variable\' doesn\'t exist

Trace:
#0 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Core/Model/Resource/Setup.php(390): Mage::exception(\'
Mage_Core\', \'Error in file: ...\')
#1 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Core/Model/Resource/Setup.php(289): Mage_Core_Model_Resource_Setup->_modifyResourceDb(\'
upgrade\', \'0.8.18\', \'0.8.28\')
#2 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Core/Model/Resource/Setup.php(233): Mage_Core_Model_Resource_Setup->_upgradeResourceDb(\'
0.8.18\', \'0.8.28\')
#3 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Core/Model/Resource/Setup.php(161): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Core/Model/App.php(399): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Core/Model/App.php(329): Mage_Core_Model_App->_initModules()
#6 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/Mage.php(627): Mage_Core_Model_App->run(Array)
#7 /nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/index.php(80): Mage::run(\'
\', \'store\')
#8 {main}

It says, wm_core_email_variable not available.  So, I tried creating , but then it says, ALREADY EXISTS.

Damn, this is so frustrating.

You got an idea ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageClub
Guru
 
Avatar
Total Posts:  382
Joined:  2009-07-25
India
 

And I installed one 1.5.1 demo site and ran the database repair tool as well.
But it gave me the same dead results :|

See the attached image to see the error from Magento Repair Tool.

Image Attachments
Screen Shot 2011-08-21 at 8.26.51 PM.png
 
Magento Community Magento Community
Magento Community
Magento Community
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3215
Joined:  2009-02-26
Minneapolis MN
 

You have a couple of options. Once you install times out you may get errors due to tables created during the uncompleted install. You maybe able to work through these errors by restarting the install. Often the install process will continue.

The other option is to start fresh with your original not-upgraded version of the database.

It is always cleanest if you upgrade from a generic version of Magento using a fresh install and your original database.

The 1.6 upgrade can take a while (As will the EE1.11 upgrade) so you need to give it some time.

If you want to get past these errors that persist you can edit the sql upgrade files with a if exist statement. This is much better than manually creating tables. I would always allow Magento to create the tables for you.

Hope that helps

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageClub
Guru
 
Avatar
Total Posts:  382
Joined:  2009-07-25
India
 

Well, I just tried both ways :

1. Started the install process again, by removing local.xml , but it threw the same error, after processing the database step.

Means, its just not able to create the wm_core_email_variable .

It says.

Error in file"/nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.18-0.8.19.php" SQLSTATE[42S02]Base table or view not found1146 Table 'db107651_wm.wm_core_email_variable' doesn't exist

Is there anything I can do by going to app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.18-0.8.19.php and forcing it to work ?

I think, this is the last step and then it would be DONE!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3215
Joined:  2009-02-26
Minneapolis MN
 

Try adding this to the upgrade script

DROP TABLE IF EXISTS {$this->getTable('module/table')};
CREATE TABLE {$this->getTable('module/table')};

This will DROP the table so be careful

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageClub
Guru
 
Avatar
Total Posts:  382
Joined:  2009-07-25
India
 

Ok did that and it went past that step.

Now the new error is,

Error in file"/nfs/c07/h04/mnt/107651/domains/qubesys.net/html/wm/html/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.19-0.8.20.php" SQLSTATE[42S02]Base table or view not found1146 Table 'db107651_wm.wm_core_variable_value' doesn't exist

So, I tried entering your above IF code into this new file, but it threw a PHP error.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3215
Joined:  2009-02-26
Minneapolis MN
 

I would not put a drop if exists on most tables as you will have data in those tables that you need.

Your error on the table is most likely due to foreign keys so it’s a good thing it didn’t work!!

You could try some like if not exists the do something and leave out the drop

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageClub
Guru
 
Avatar
Total Posts:  382
Joined:  2009-07-25
India
 

OK, Im not sure, how to do that, since Im not much known to EAV structure or database.

And developer is on a short vacation already.

Client is not ready to wait, since its a live website.

Stuck :(

 
Magento Community Magento Community
Magento Community
Magento Community
 
UnderDogg
Member
 
Total Posts:  63
Joined:  2011-06-25
 

If not exists is not EAV structure syntax, but just plain MySQL syntax.
There are numerous examples on this page:
http://dev.mysql.com/doc/refman/5.1/en/create-table.html
and here a very specific example:

CREATE TABLE IF NOT EXISTS `schema`.`Employee` (
`
idEmployeeVARCHAR(45NOT NULL ,
`
NameVARCHAR(255NULL ,
`
idAddressesVARCHAR(45NULL ,
PRIMARY KEY (`idEmployee`) ,
CONSTRAINT `fkEmployee_Addresses`
FOREIGN KEY `fkEmployee_Addresses` (`idAddresses`)
REFERENCES `schema`.`Addresses` (`idAddresses`)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
ENGINE InnoDB
DEFAULT CHARACTER SET utf8
COLLATE 
utf8_bin
Try to apply the example in the code block to 1 of your tables that already exists, i.e. apply it in your upgrade script.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageClub
Guru
 
Avatar
Total Posts:  382
Joined:  2009-07-25
India
 

Getting this,

Fatal error: Undefined class constant ‘TYPE_TEXT’ in /home/thevape2/public_html/app/code/core/Mage/ImportExport/sql/importexport_setup/mysql4-upgrade-1.6.0.1-1.6.0.2.php on line 34

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top