magento: Cannot add or update a child row: a foreign key constraint fails
Tech-Today

magento: Cannot add or update a child row: a foreign key constraint fails


I am in the stage of migrating my local database of magento to public when I have encountered this error.

How did it happen:
1.) I use phpmyadmin3.2 to export the sql statements.
2.) In my host mysql's phpmyadmin, I have executed the dump statements.

And I got the following error:
SQL query:


--
-- Constraints for table `eav_entity_attribute`
--
ALTER TABLE `eav_entity_attribute` ADD CONSTRAINT `FK_EAV_ENTITY_ATTRIBUTE_ATTRIBUTE` FOREIGN KEY ( `attribute_id` ) REFERENCES `eav_attribute` ( `attribute_id` ) ON DELETE CASCADE ON UPDATE CASCADE ,
ADD CONSTRAINT `FK_EAV_ENTITY_ATTRIBUTE_GROUP` FOREIGN KEY ( `attribute_group_id` ) REFERENCES `eav_attribute_group` ( `attribute_group_id` ) ON DELETE CASCADE ON UPDATE CASCADE

MySQL said: Documentation
#1452 - Cannot add or update a child row: a foreign key constraint fails (`db294125795/#sql-1357_3238a8`, CONSTRAINT `FK_EAV_ENTITY_ATTRIBUTE_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE)


So what did I do:
1.) I simply re-dumped my local database sql statements using phpmyadmin this time checking "Disable foreign key contraints checkbox" and it executed without error.

See attached image for reference.





- Web Development
WordpressConfigure Custom Wordpress PermalinkZencartHow to add a customize product admin fields in zencart by editing/adding extra codesJoomlaHow to install/setup/configure joomla to run in a xampp setup. This avoids the technical detail of manually installing...

- How To Alter Bit And Date Column's Default Value In Mssql
Aside from using the SQL Designer, you can alter a bit and date column's default value. ALTER TABLE TableName ADD CONSTRAINT TableName_Disabled DEFAULT 0 FOR Disabled ALTER TABLE TableName ADD CONSTRAINT TableName_DateCreated DEFAULT getdate() FOR...

- How To Use Entityframework Codefirst To Update Your Database
This tutorial will attempt to explain how to update an already existing database using EntityFramework's CodeFirst approach. We need: 1.) VS2010 SP1 2.) NuGet 3.) EntityFramework 4.1 4.) EntityFramework.Migrations   Steps: 1.) We need to make...

- Mysql Engine: Myisam Vs Innodb
MyISAM (http://dev.mysql.com/doc/refman/5.0/en/myisam-storage-engine.html) -to create a MyISAM table, add ENGINE = MYISAM; at the end of create table script -supports table locking (this is an issue when you need to backup the whole database) -fast execution...

- Operation Must Use An Updateable Query
I am currently developing a certain application in MS Access and I need to link 2 databases, select data from one and move it to the second. In access I have no problem using the TransferDatabase command. DoCmd.TransferDatabase acLink, "Microsoft Access",...



Tech-Today








.