Try the Demo

Magento Forum

   
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘4859-288-14’ for key 2
 
markf
Sr. Member
 
Total Posts:  143
Joined:  2007-09-20
 

When trying to upgrade from 1.1.8 to 1.2.1 i get this error:

Error in file: “/home/markf/domains/domain.com/public_html/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.29-0.9.30.php” - SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘4859-288-14’ for key 2
Trace:
#0 /home/markf/domains/domain.com/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(292): Mage::exception(’Mage_Core’, ‘Error in file: ...’)
#1 /home/markf/domains/domain.com/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(179): Mage_Core_Model_Resource_Setup->_modifyResourceDb(’upgrade’, ‘0.9.29’, ‘0.9.31’)
#2 /home/markf/domains/domain.com/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(146): Mage_Core_Model_Resource_Setup->_upgradeResourceDb(’0.9.29’, ‘0.9.31’)
#3 /home/markf/domains/domain.com/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(121): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /home/markf/domains/domain.com/public_html/app/code/core/Mage/Core/Model/Config.php(214): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /home/markf/domains/domain.com/public_html/app/code/core/Mage/Core/Model/App.php(242): Mage_Core_Model_Config->init(Array)
#6 /home/markf/domains/domain.com/public_html/app/Mage.php(432): Mage_Core_Model_App->init(’’, ‘store’, Array)
#7 /home/markf/domains/domain.com/public_html/app/Mage.php(453): Mage::app(’’, ‘store’, Array)
#8 /home/markf/domains/domain.com/public_html/index.php(52): Mage::run()
#9 {main}

 Signature 

AllstateSign.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
Hengky Irawan
Jr. Member
 
Avatar
Total Posts:  10
Joined:  2008-05-25
Indonesia
 

I got the same error too.

 Signature 

HTML Factory. Convert your PSD, PNG, AI designs to high quality, cross-browser, and valid XHTML/ CSS markup.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Hengky Irawan
Jr. Member
 
Avatar
Total Posts:  10
Joined:  2008-05-25
Indonesia
 

Temporary workaround.
I removed the add UNIQUE key from mysql upgrade file

Edit /app/code/core/Mage/Sales/sql/sales_setup/upgrade-0.9.29-0.9.30.php

And comment out everything inside. So it would be like this

/*
$installer->getConnection()->addKey("{$tableOrder}_datetime", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_decimal", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_int", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_text", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_varchar", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');

$installer->getConnection()->addKey("{$tableOrderEntity}_datetime", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_decimal", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_int", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_text", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_varchar", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');

$installer->getConnection()->addKey($tableOrderEntity, 'IDX_SALES_ORDER_ENTITY_PARENT', 'parent_id');
*/

Maybe this could help until somebody has a fix for it.

 Signature 

HTML Factory. Convert your PSD, PNG, AI designs to high quality, cross-browser, and valid XHTML/ CSS markup.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Alexx
Jr. Member
 
Total Posts:  6
Joined:  2008-12-15
 

Same problem here:

Error in file"/home/xxxnl/public_html/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.29-0.9.30.php" SQLSTATE[23000]Integrity constraint violation1062 Duplicate entry '96-599-8' for key 2
Trace
:
#0 /home/xxxnl/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(292): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /home/xxxnl/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(179): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '0.9.29', '0.9.31')
#2 /home/xxxnl/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(146): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('0.9.29', '0.9.31')
#3 /home/xxxnl/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(121): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /home/xxxnl/public_html/app/code/core/Mage/Core/Model/Config.php(214): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /home/xxxnl/public_html/app/code/core/Mage/Core/Model/App.php(242): Mage_Core_Model_Config->init(Array)
#6 /home/xxxnl/public_html/app/Mage.php(432): Mage_Core_Model_App->init('', 'store', Array)
#7 /home/xxxnl/public_html/app/Mage.php(453): Mage::app('', 'store', Array)
#8 /home/xxxnl/public_html/index.php(52): Mage::run()
#9 {main}

Thanks for the temporary fix.

 
Magento Community Magento Community
Magento Community
Magento Community
 
zadpro
Sr. Member
 
Avatar
Total Posts:  247
Joined:  2007-12-10
FL, USA
 

Exact same error on my test store:

Error in file"/home/mysite/public_html/test/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.29-0.9.30.php" SQLSTATE[23000]Integrity constraint violation1062 Duplicate entry '3-599-8' for key 2
Trace
:
#0 /home/mysite/public_html/test/app/code/core/Mage/Core/Model/Resource/Setup.php(292): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /home/mysite/public_html/test/app/code/core/Mage/Core/Model/Resource/Setup.php(179): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '0.9.29', '0.9.31')
#2 /home/mysite/public_html/test/app/code/core/Mage/Core/Model/Resource/Setup.php(146): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('0.9.29', '0.9.31')
#3 /home/mysite/public_html/test/app/code/core/Mage/Core/Model/Resource/Setup.php(121): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /home/mysite/public_html/test/app/code/core/Mage/Core/Model/Config.php(214): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /home/mysite/public_html/test/app/code/core/Mage/Core/Model/App.php(242): Mage_Core_Model_Config->init(Array)
#6 /home/mysite/public_html/test/app/Mage.php(432): Mage_Core_Model_App->init('', 'store', Array)
#7 /home/mysite/public_html/test/app/Mage.php(453): Mage::app('', 'store', Array)
#8 /home/mysite/public_html/test/index.php(52): Mage::run()
#9 {main}

Any solution?

 Signature 

ZadPro.com

Managing BargainCollection.com Powered by Magento 1.3.2.3

Follow BargainCollection on twitter

 
Magento Community Magento Community
Magento Community
Magento Community
 
elfling
Enthusiast
 
Avatar
Total Posts:  821
Joined:  2008-10-21
 

And same error here.

 Signature 

creative media group - Magento modules by elfling
Nimbus Hosting UK - Magento Hosting - Fast, Reliable and Secure - Tell them elfling sent you

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ian M
Jr. Member
 
Total Posts:  25
Joined:  2008-01-16
 

Same problem here - clean install on SimpleHelix shared server

Anyone got any ideas on how to fix this issue?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Danielc1234
Sr. Member
 
Avatar
Total Posts:  175
Joined:  2008-01-09
Miami, FL - United States
 

Having same problem, store is down! Any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
zadpro
Sr. Member
 
Avatar
Total Posts:  247
Joined:  2007-12-10
FL, USA
 

OK, here is what I found out so far: 
The file : /home/mysite/public_html/test/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.29-0.9.30.php that causing this error is trying to addKey to two tables: sales_order and sales_order_entity.

So,
1- in phpMyAdmin I exported both tables as sql and save a copy on my pc.
2- I truncated both of the above tables.
3- I visits my home page and WALA it loaded with no errors. The admin also loaded without errors. But because I deleted the data from the order tables, I had no orders in my admin -> Sales -> Order or on my Dashboard.
4- So I went back to phpMyAdmin and tried to import both tables back to the database to retrieve the data. But I got these errors:

When importing sales_order:

SQL query:

--
-- 
Constraints for dumped tables
--
--
-- 
Constraints for table `sales_order`
--
ALTER TABLE `sales_orderADD CONSTRAINT `FK_SALE_ORDER_STOREFOREIGN KEY ( `store_id` ) REFERENCES `core_store` ( `store_id` ) ON DELETE SET NULL ON UPDATE CASCADE ,
ADD CONSTRAINT `FK_SALE_ORDER_TYPEFOREIGN KEY ( `entity_type_id` ) REFERENCES `eav_entity_type` ( `entity_type_id` ) ON DELETE CASCADE ON UPDATE CASCADE ;

MySQL saidDocumentation
#1005 - Can't create table './mydatabase1_database1/#sql-5291_20d7d1.frm' (errno: 121)

And I got the following error when importing sales_order_entity:

SQL query:

--
-- 
Constraints for dumped tables
--
--
-- 
Constraints for table `sales_order_entity`
--
ALTER TABLE `sales_order_entityADD CONSTRAINT `FK_sales_order_entity_typeFOREIGN KEY ( `entity_type_id` ) REFERENCES `eav_entity_type` ( `entity_type_id` ) ON DELETE CASCADE ON UPDATE CASCADE ,
ADD CONSTRAINT `FK_SALE_ORDER_ENTITY_STOREFOREIGN KEY ( `store_id` ) REFERENCES `core_store` ( `store_id` ) ON DELETE SET NULL ON UPDATE CASCADE ;

MySQL saidDocumentation
#1005 - Can't create table './mydatabase1_database1/#sql-5291_20d997.frm' (errno: 121)

So, as per above, the data in both tables are being imported. When I go to admin--> Sales -> Orders I see all the orders there, but when I click on the orders to see the details, nothing comes up. In dashboard the number of orders remains 0.

As you can see both errors are mySql errorno:121.
I’m not an expert in mySql, but I did a google on this error and I found that this error happens when you use the same foreign key names on different tables. I don’t know how to fix this. If anyone here is expert in mySQL this may be a clue to how this could be fixed.
Good luck.

 Signature 

ZadPro.com

Managing BargainCollection.com Powered by Magento 1.3.2.3

Follow BargainCollection on twitter

 
Magento Community Magento Community
Magento Community
Magento Community
 
zadpro
Sr. Member
 
Avatar
Total Posts:  247
Joined:  2007-12-10
FL, USA
 

I was able to upgrade my store from 1.2.0.3 to 1.2.1 and fix the above problem. Here is what I did.
NOTE: Please note that this post is only to let you know that this method worked for my store. I cant guarantee that it will work for you. Make sure to use this on your test store first. You will be editing one file and your database manually. You should know what you are doing.

1- BACK UP BACK UP BACK UP EVERYTHING, I backed up my database and all my files and directories, just in case.
2- Admin -> System -> Cache Management and DISABLE all cache
3- I ran the following command via SSH:

rm -rf /path/to/magento/var/cache/* /path/to/magento/var/session/*

Obviously you need to change /path/to/magento/ to your host path. In my case it was /home/mystore/public_html/

4- Return to Admin. I have been logged out because I already cleared the session. I Logged back in and to System -> Magento Connect -> Magento Connect Manager.
5- I clicked on check for updates. All available updates highlighted. I selected all upgrades, checked the box next to “Clear all sessions after successfull install or upgrade” ( I know it has a typo, it should say successful!).
6- Held my breath and clicked on commit changes. Upgrade took 2-3 minutes and was done. The command window showed that everything was installed OK.
7- After upgrade completed, I clicked on Refresh button. OMG. I had the following error:

Error in file"/home/mysite/public_html/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.29-0.9.30.php" SQLSTATE[23000]Integrity constraint violation1062 Duplicate entry '3-599-8' for key 2
Trace
:
#0 /home/mysite/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(292): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /home/mysite/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(179): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '0.9.29', '0.9.31')
#2 /home/mysite/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(146): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('0.9.29', '0.9.31')
#3 /home/mysite/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(121): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /home/mysite/public_html/app/code/core/Mage/Core/Model/Config.php(214): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /home/mysite/public_html/app/code/core/Mage/Core/Model/App.php(242): Mage_Core_Model_Config->init(Array)
#6 /home/mysite/public_html/app/Mage.php(432): Mage_Core_Model_App->init('', 'store', Array)
#7 /home/mysite/public_html/app/Mage.php(453): Mage::app('', 'store', Array)
#8 /home/mysite/public_html/index.php(52): Mage::run()
#9 {main}

8- I opened the following file in Dreamweaver: /app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.29-0.9.30.php. This file content is:

$installer $this;
/* @var $installer Mage_Sales_Model_Mysql4_Setup */

$tableOrder       $this->getTable('sales/order');
$tableOrderEntity $this->getTable('sales/order_entity');

$installer->getConnection()->addKey("{$tableOrder}_datetime"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_decimal"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_int"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_text"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_varchar"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');

$installer->getConnection()->addKey("{$tableOrderEntity}_datetime"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_decimal"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_int"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_text"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_varchar"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');

$installer->getConnection()->addKey($tableOrderEntity'IDX_SALES_ORDER_ENTITY_PARENT''parent_id');

9- I added a /* and */ to the first section to remove them from running

$installer $this;
/* @var $installer Mage_Sales_Model_Mysql4_Setup */

$tableOrder       $this->getTable('sales/order');
$tableOrderEntity $this->getTable('sales/order_entity');
/*
$installer->getConnection()->addKey("{$tableOrder}_datetime", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_decimal", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_int", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_text", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_varchar", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
*/
$installer->getConnection()->addKey("{$tableOrderEntity}_datetime"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_decimal"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_int"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_text"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_varchar"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');

$installer->getConnection()->addKey($tableOrderEntity'IDX_SALES_ORDER_ENTITY_PARENT''parent_id');

10- Return to my browser and to my store at http://www.BargainCollection.com. I had the same error again. If you don’t have the same error and you see an error regarding “CatalogInventory” then skip step 11 and go to step 12.
11- Next I changed the /app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.29-0.9.30.php to this: (this time I’m removing the /* and */ from first section and adding to the second section):

$installer $this;
/* @var $installer Mage_Sales_Model_Mysql4_Setup */

$tableOrder       $this->getTable('sales/order');
$tableOrderEntity $this->getTable('sales/order_entity');

$installer->getConnection()->addKey("{$tableOrder}_datetime"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_decimal"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_int"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_text"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrder}_varchar"'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id''attribute_id''entity_type_id'), 'unique');
/*
$installer->getConnection()->addKey("{$tableOrderEntity}_datetime", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_decimal", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_int", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_text", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
$installer->getConnection()->addKey("{$tableOrderEntity}_varchar", 'UNQ_ENTITY_ATTRIBUTE_TYPE', array('entity_id', 'attribute_id', 'entity_type_id'), 'unique');
*/
$installer->getConnection()->addKey($tableOrderEntity'IDX_SALES_ORDER_ENTITY_PARENT''parent_id');

12- Returned to my browser and visited my site (remember to clear your browser cache every time). This time I had the following error:

Error in file"/home/mysite/public_html/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.4-0.7.5.php" SQLSTATE[42S01]Base table or view already exists1050 Table 'cataloginventory_stock_status' already exists
Trace
:
#0 /home/mysite/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(292): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /home/mysite/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(179): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '0.7.4', '0.7.5')
#2 /home/mysite/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(146): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('0.7.4', '0.7.5')
#3 /home/mysite/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(121): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /home/mysite/public_html/app/code/core/Mage/Core/Model/Config.php(214): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /home/mysite/public_html/app/code/core/Mage/Core/Model/App.php(242): Mage_Core_Model_Config->init(Array)
#6 /home/mysite/public_html/app/Mage.php(432): Mage_Core_Model_App->init('', 'store', Array)
#7 /home/mysite/public_html/app/Mage.php(453): Mage::app('', 'store', Array)
#8 /home/mysite/public_html/index.php(52): Mage::run()
#9 {main}
13- Returned to Dreamweaver and to /app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.29-0.9.30.php and removed the /* and */ that I added before.
14- Using phpMySQL I removed (delete) the “cataloginventory_stock_status” table.
15- Return to my browser and visit my site. On first visit it may take few minutes to load. This is because the scripts are updating the database. Home page loaded fine, but I had error when I was clicking on any category or product. The error was regarding cataloginventory_stock_status does not exist. the same error was coming up when going to admin. I returned to phpMyAdmin and ran the following sql command:

CREATE TABLE IF NOT EXISTS `cataloginventory_stock_status` (
  `
product_idint(10unsigned NOT NULL,
  `
website_idsmallint(5unsigned NOT NULL,
  `
stock_idsmallint(4unsigned NOT NULL,
  `
qtydecimal(12,4NOT NULL default '0.0000',
  `
stock_statustinyint(3unsigned NOT NULL,
  
PRIMARY KEY  (`product_id`,`website_id`,`stock_id`),
  
KEY `FK_CATALOGINVENTORY_STOCK_STATUS_STOCK` (`stock_id`),
  
KEY `FK_CATALOGINVENTORY_STOCK_STATUS_WEBSITE` (`website_id`)
ENGINE=InnoDB DEFAULT CHARSET=utf8;


ALTER TABLE `cataloginventory_stock_status`
  
ADD CONSTRAINT `FK_CATALOGINVENTORY_STOCK_STATUS_STOCKFOREIGN KEY (`stock_id`) REFERENCES `cataloginventory_stock` (`stock_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  
ADD CONSTRAINT `FK_CATALOGINVENTORY_STOCK_STATUS_PRODUCTFOREIGN KEY (`product_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  
ADD CONSTRAINT `FK_CATALOGINVENTORY_STOCK_STATUS_WEBSITEFOREIGN KEY (`website_id`) REFERENCES `core_website` (`website_id`) ON DELETE CASCADE ON UPDATE CASCADE;

16- I returned to my store. Every page was up and running with no error. But, all products was listed as “Out of Stock”
17- In Admin --> System --> cache management, I clicked on Refresh Inventory Stock status. It took 2-3 minutes for over 10,000 products and after that everything was working properly.

THAT WAS IT!. It fixed the problem and my site was back live and running. I and I just received a new order couple minutes after I was back up!
Final touch ups:  I went to Admin -> System -> Cache Management: and refreshed catalog rewrite, image cache, search index and Layered Navigation Indices. I enabled all cache. And I was done.

I hope this helps you to fix your problem, but again, make sure to try it out on your test store before you use it on your production store.

Good Luck.

 Signature 

ZadPro.com

Managing BargainCollection.com Powered by Magento 1.3.2.3

Follow BargainCollection on twitter

 
Magento Community Magento Community
Magento Community
Magento Community
 
turbo1
Sr. Member
 
Avatar
Total Posts:  296
Joined:  2008-08-19
Los Angeles, CA
 

@zadpro

I just wanted to say kudos for one of the best-documented fixes I’ve ever seen on this forum.  cool smile

 Signature 

My contributions: Google Base Data Feed script (thanks Anda!), Shopping.com Data Feed script,
Stop Magento from sending data back to Varien

No longer using Magento as of April 2009

 
Magento Community Magento Community
Magento Community
Magento Community
 
zadpro
Sr. Member
 
Avatar
Total Posts:  247
Joined:  2007-12-10
FL, USA
 

@turbo1
Thanks, I hope it worked for you…

 Signature 

ZadPro.com

Managing BargainCollection.com Powered by Magento 1.3.2.3

Follow BargainCollection on twitter

 
Magento Community Magento Community
Magento Community
Magento Community
 
texxmexx
Member
 
Total Posts:  41
Joined:  2009-11-03
 

Hello,

I found this topic with Google help.

I’ve got the same error

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘6’ for key ‘PRIMARY’

Does the tutorial from Zadpro work for my issue too? I’ve got Magento CE 1.3.2.4 installed and that wasnt a problem with upgrading magento.
Also i got the error first time when the shop was free for all visitors. before i tested with testproducts and categories. and there i hadn’t the problem.

Would be great if anyone knows an answer.

THANKS!

EDIT:

May help: The error always comes when i visit the shop the first time (session in browser) and add the first configurable product to shopping cart. after the error the product is in shopping cart and all following add’s to shopping cart work well.

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