SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (
marketplace
.mg_nbmp_review
, CONSTRAINTFK__nbmp_vendor
FOREIGN KEY (vendor_id
) REFERENCES('marketplace/vendor')
(vendor_id
) ON DELETE CASCADE ON UPDATE CASCADE), query was: INSERT INTOmg_nbmp_review
(vendor_id
,vendor_name
,customer_id
,customer_name
,customer_email
,rating
,review_comment
,reviewed_date
) VALUES (?, ?, ?, ?, ?, ?, ?, '2015-04-08 11:51:58')
<?php
$installer = $this;
$installer->startSetup();
$installer->run("
DROP TABLE IF EXISTS {$this->getTable('vendorreview/review')};
CREATE TABLE IF NOT EXISTS {$this->getTable('vendorreview/review')} (
`review_id` INT(11) NOT NULL AUTO_INCREMENT,
`vendor_id` INT(11) NOT NULL DEFAULT '0',
`vendor_name` VARCHAR(1000) NOT NULL DEFAULT '0',
`customer_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`customer_name` VARCHAR(255) NOT NULL DEFAULT '0',
`customer_email` VARCHAR(255) NOT NULL DEFAULT '0',
`rating` ENUM('1','2','3','4','5') NOT NULL,
`review_comment` VARCHAR(1000) NULL DEFAULT '0',
`reply` VARCHAR(255) NULL DEFAULT '0',
`status` INT(10) NOT NULL DEFAULT '0',
`reviewed_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`review_id`),
INDEX `FK__nbmp_vendor` (`vendor_id`),
INDEX `FK__customer_entity` (`customer_id`),
CONSTRAINT `FK__nbmp_vendor` FOREIGN KEY (`vendor_id`) REFERENCES {$this->getTable('marketplace/vendor')} (`vendor_id`) ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT `FK__customer_entity` FOREIGN KEY (`customer_id`) REFERENCES {$this->getTable('customer/entity')} (`entity_id`) ON UPDATE CASCADE ON DELETE CASCADE
)
COMMENT='Vendor Review Table'
ENGINE=InnoDB;
");
$installer->endSetup();
Where i m wrong?