Bug #36674 Synchronization generates invalid DDL when adding foreign key
Submitted: 12 May 2008 20:41 Modified: 11 Jul 2008 10:18
Reporter: Scott Noyes Email Updates:
Status: Closed Impact on me:
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.0.21 SE OS:Microsoft Windows (XP)
Assigned to: Vladimir Kolesnikov CPU Architecture:Any
Triage: D3 (Medium)

[12 May 2008 20:41] Scott Noyes
Workbench generated the following statement when synchronizing a table and adding a foreign key:

ALTER TABLE `logic`.`categories` ADD CONSTRAINT `fk_categories_puzzles`
  FOREIGN KEY (`puzzleId` )
  REFERENCES `logic`.`puzzles` (`puzzleId` )
  ON UPDATE NO ACTIONADD INDEX fk_categories_puzzles (`puzzleId` ASC) , ENGINE = InnoDB 

There is a missing comma after ON UPDATE NO ACTION, resulting in a syntax error.

How to repeat:
The original table was reverse engineered; it was MyISAM and had no indexes. In the model, I changed the table to InnoDB, added a foreign key, and then synchronized with the live database.

Suggested fix:
Correct the syntax error.
[6 Jun 2008 16:22] Johannes Taxacher
fix confirmed. will go into 5.0.23
[11 Jul 2008 10:18] Tony Bedford
An entry has been added to the 5.0.23 changelog:

Workbench generated incorrect syntax when attempting to synchronize with a live server. The resultant code was missing commas which resulted in a syntax error.