Description:
Executing SQL script in server
ERROR: Error 1022: Can't write; duplicate key in table 'web_demande'
SQL Code:
-- -----------------------------------------------------
-- Table `VXP_System`.`web_demande`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `VXP_System`.`web_demande` (
`ID` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`web_demande_type_ID` INT UNSIGNED NOT NULL,
`contact_client_ID` INT UNSIGNED NOT NULL,
`web_visiteur_ID` INT UNSIGNED NOT NULL,
PRIMARY KEY (`ID`),
INDEX `web_demande_type_ID` (`web_demande_type_ID` ASC),
INDEX `contact_client_ID` (`contact_client_ID` ASC),
INDEX `web_visiteur_ID` (`web_visiteur_ID` ASC),
CONSTRAINT `FK_web_demande_type_ID`
FOREIGN KEY (`web_demande_type_ID`)
REFERENCES `VXP_System`.`web_demandes_types` (`ID`)
ON DELETE RESTRICT
ON UPDATE CASCADE,
CONSTRAINT `FK_contact_client_ID`
FOREIGN KEY (`contact_client_ID`)
REFERENCES `VXP_System`.`contacts_clients` (`ID`)
ON DELETE RESTRICT
ON UPDATE CASCADE,
CONSTRAINT `FK_web_visiteur_ID`
FOREIGN KEY (`web_visiteur_ID`)
REFERENCES `VXP_System`.`web_visiteurs` (`ID`)
ON DELETE RESTRICT
ON UPDATE CASCADE)
ENGINE = InnoDB
SQL script execution finished: statements: 55 succeeded, 1 failed
Fetching back view definitions in final form.
Nothing to fetch
How to repeat:
When we user export or 'Forward Engineer' from the model, the tables that have been renamed and that contain Foreign Keys generate errors that said 'duplicate keys).
I have to rename the tables to their original names, or I have to delete the Foreign Keys and recreate it if I want to avoid that error.