Bug #53037 Delete Foreign Key Columns deletes columns participating in other relationships
Submitted: 21 Apr 2010 19:56 Modified: 20 Aug 2010 11:49
Reporter: Mark Drolshagen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.19 OS:Any
Assigned to: Alfredo Kojima CPU Architecture:Any
Tags: foreign keys, relationships

[21 Apr 2010 19:56] Mark Drolshagen
Description:
In EER Diagramming, when deleting a relationship, the user is asked to confirm whether to delete the child columns in use by the relationship.

If the user presses 'Yes', my expectation is that the child columns would be deleted only if they are *not* actively participating in another relationship. Instead, EER deletes all columns in the child table that participate in the relationship being deleted, even if they are actively participating in other relationships. This can cause other relationships to break and generate a loss of data should a critical column be dropped during synchronization.

How to repeat:
- Within an EER Diagram, right-click on an existing relationship, select 'Delete'.

- The user is presented with a popup named 'Delete Foreign Key Columns' that asks Please confirm whether columns used by the foreign key should be deleted too". 

- Press 'Yes'.

- All child columns are deleted.

Suggested fix:
Delete only child fields that have exactly one existing relationship (the one being deleted).
[22 Apr 2010 11:25] Valeriy Kravchuk
Schema to demonstrate the problem

Attachment: bug53037.mwb (application/octet-stream, text), 6.66 KiB.

[22 Apr 2010 11:26] Valeriy Kravchuk
Thank you for the problem report.
[23 Apr 2010 21:56] Alfredo Kojima
An internal check has been added so that columns referenced by FKs from other tables are left untouched.
[20 Aug 2010 11:49] Johannes Taxacher
Thank you for your bug report. This issue has already been fixed in the latest released version of that product, which you can download at

  http://www.mysql.com/downloads/