0

I have deleted Magento products accidentally, so i tried to restore them. I have an old backup, so my idea is to delete all catalog tables that begins with 'catalog_', and to import them from a backup, but when trying to import tables, i got this error

#1005 - Can't create table xxxx_dbnew.catalog_product_entity (errno: 150 "Foreign key constraint is incorrectly formed") The table structure

CREATE TABLE `catalog_product_entity` (
`entity_id` int(10) UNSIGNED NOT NULL COMMENT 'Entity ID',
`attribute_set_id` smallint(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT  'Attribute Set ID',
`type_id` varchar(32) NOT NULL DEFAULT 'simple' COMMENT 'Type ID',
`sku` varchar(64) DEFAULT NULL COMMENT 'SKU',
`has_options` smallint(6) NOT NULL DEFAULT 0 COMMENT 'Has Options',
`required_options` smallint(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Required Options',
`created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Creation Time',
`updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE   current_timestamp() COMMENT 'Update Time'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Product Table';

Any solution?

Tarek Fellah
  • 179
  • 3
  • 4
  • 18
  • without knowing the table and all referenced tables it is **imposible** to help – nbk Jan 23 '21 at 10:50
  • please provide more information about the tables and the methods you followed to import them. – Guissous Allaeddine Jan 23 '21 at 10:52
  • You can temporarily, disable foreign keys using `SET FOREIGN_KEY_CHECKS = 0;`. (P.S. This is not a guarantee that restored data will be OK) – Luuk Jan 23 '21 at 10:52
  • I think [this thread](https://stackoverflow.com/questions/8434518/mysql-foreign-key-constraint-is-incorrectly-formed-error) can help. – Maned Wolf Jan 24 '21 at 10:34

0 Answers0