0

I'm trying to synchronize my EER model with my DB in MySQL Workbench, and one table fails to synchronize. I also checked that my foreign keys have the same datatype as the column they refer to. Here is the output:

Executing SQL script in server
ERROR: Error 1005: Can't create table 'veiling.#sql-4f8_47' (errno: 150)

ALTER TABLE `veiling`.`boden` 
  ADD CONSTRAINT `fk_boden_veilingen1`
  FOREIGN KEY (`veilingId` )
  REFERENCES `veiling`.`veilingen` (`veilingId` )
  ON DELETE NO ACTION
  ON UPDATE NO ACTION, 
  ADD CONSTRAINT `fk_boden_gebruikers1`
  FOREIGN KEY (`gebruikerId` )
  REFERENCES `veiling`.`gebruikers` (`gebruikerId` )
  ON DELETE NO ACTION
  ON UPDATE NO ACTION
, ADD INDEX `fk_boden_veilingen1_idx` (`veilingId` ASC) 
, ADD INDEX `fk_boden_gebruikers1_idx` (`gebruikerId` ASC) 
, DROP INDEX `fk_boden_gebruikers1_idx` 
, DROP INDEX `fk_boden_veilingen1_idx` 

SQL script execution finished: statements: 3 succeeded, 1 failed
dgilperez
  • 10,716
  • 8
  • 68
  • 96
svdotbe
  • 168
  • 1
  • 3
  • 16
  • Try adding backticks around the table names. – Sam Dufel Apr 30 '13 at 16:20
  • thanks for the reply, but there were already backticks around it (since i didn't type these statements manually, it's created by the wizard in mySQL workbench). They aren't displayed when you paste your code here. – svdotbe Apr 30 '13 at 16:37
  • Sometimes if you creating a few new tables with foreign keys that refer to one another, it helps to create the tables first, then add the keys after all tables are added. mysql workbench tries to do everything in one step, but sometimes that just doesn't work. – Sam Dufel Apr 30 '13 at 16:40

0 Answers0