Bug #53420 Foreign Key problem in Synchronize Model functionality
Submitted: 4 May 2010 20:19 Modified: 18 Jun 2010 10:48
Reporter: Chris Hale Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.20 OS:Any (Windows XP Pro)
Assigned to: Alexander Musienko CPU Architecture:Any
Tags: foreign keys, indexes, synchronize model

[4 May 2010 20:19] Chris Hale
Description:
This is a issue that happens when you model a foreign key relationship in a model and select the property modelOnly property to 1.  When you synchronize the model, the ddl generated properly omits the foreign key relationship but it includes the proposed foreign key indexes.  I don't believe these indexes should exist since the foreign key isn't defined.

How to repeat:
Create a model from scratch
add a foreign key relationship
change property on the connection to modelOnly to 1
then go to synchronize the model with an existing database
check the output ddl to see the erroneous indexes that it wants to create.

Suggested fix:
If you select a relationship as modelonly, it should omit any and all automatically generated indexes that are needed to support that relationship.  Another idea would be to add another property that potentially lets you select whether or not to include the foreign key in a index.  Either way would work great.
[4 May 2010 20:20] Chris Hale
Forgot to mention that this bug only happens on synchronize.  It doesn't seem to happen with forward engineering a db.  

Thanks
[5 May 2010 7:17] Valeriy Kravchuk
Thank you for the problem report. Verified just as described on XP.
[17 Jun 2010 20:29] Johannes Taxacher
fix confirmed in repository
[18 Jun 2010 10:48] Tony Bedford
An entry has been added to the 5.2.24 changelog:

If a foreign key relationship was created, and its modelOnly property set, then when the model was synchronized with a live database, the relationship was correctly excluded, however the DDL code for the foreign key indexes was still generated in the synchronization script.