Magento – SQLSTATE[HY000]: General error: 1025 Error on rename of – report_compared_product_index and report_viewed_product_index

Posted by | Reference | No Comments
  • 0
  • July 29, 2013

SQL error when attempting to upgrade Magento across 1.4.2 –> 1.7

/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php

Run the following SQL to drop the following two tables and recreate as key violations from previous versions across to 1.6 causes errors.


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `report_compared_product_index`
--
DROP TABLE IF EXISTS `report_compared_product_index`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `report_compared_product_index` (
`index_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`visitor_id` int(10) unsigned DEFAULT NULL,
`customer_id` int(10) unsigned DEFAULT NULL,
`product_id` int(10) unsigned NOT NULL,
`store_id` smallint(5) unsigned DEFAULT NULL,
`added_at` datetime NOT NULL,
PRIMARY KEY (`index_id`),
UNIQUE KEY `UNQ_BY_VISITOR` (`visitor_id`,`product_id`),
UNIQUE KEY `UNQ_BY_CUSTOMER` (`customer_id`,`product_id`),
KEY `IDX_STORE` (`store_id`),
KEY `IDX_SORT_ADDED_AT` (`added_at`),
KEY `product_id` (`product_id`),
CONSTRAINT `FK_REPORT_COMPARED_PRODUCT_INDEX_CUSTOMER` FOREIGN KEY (`customer_id`)
REFERENCES `customer_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_REPORT_COMPARED_PRODUCT_INDEX_PRODUCT` FOREIGN KEY (`product_id`)
REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_REPORT_COMPARED_PRODUCT_INDEX_STORE` FOREIGN KEY (`store_id`)
REFERENCES `core_store` (`store_id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `report_viewed_product_index`
--
DROP TABLE IF EXISTS `report_viewed_product_index`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `report_viewed_product_index` (
`index_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`visitor_id` int(10) unsigned DEFAULT NULL,
`customer_id` int(10) unsigned DEFAULT NULL,
`product_id` int(10) unsigned NOT NULL,
`store_id` smallint(5) unsigned DEFAULT NULL,
`added_at` datetime NOT NULL,
PRIMARY KEY (`index_id`),
UNIQUE KEY `UNQ_BY_VISITOR` (`visitor_id`,`product_id`),
UNIQUE KEY `UNQ_BY_CUSTOMER` (`customer_id`,`product_id`),
KEY `IDX_STORE` (`store_id`),
KEY `IDX_SORT_ADDED_AT` (`added_at`),
KEY `product_id` (`product_id`),
CONSTRAINT `FK_REPORT_VIEWED_PRODUCT_INDEX_CUSTOMER` FOREIGN KEY (`customer_id`)
REFERENCES `customer_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_REPORT_VIEWED_PRODUCT_INDEX_PRODUCT` FOREIGN KEY (`product_id`)
REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_REPORT_VIEWED_PRODUCT_INDEX_STORE` FOREIGN KEY (`store_id`)
REFERENCES `core_store` (`store_id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1348756 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

About john

Likes mountains when not engaged in utter nerdoid activity! Motorsport, the sea, caterpillars. Fish. Other things. When nerding it up - interested in data and information structures, applying simple yet effective solutions; does gold plate always deliver?, frontend technologies. Webby stuff kinda gets involved with those things.