Bug #65525 Request for cascaded delete query builder
Submitted: 5 Jun 2012 17:53 Modified: 13 Jun 2013 23:28
Reporter: Brandon Johnson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S4 (Feature request)
Version:Any OS:Any
Assigned to: CPU Architecture:Any
Tags: cascade, constraints, delete, fkey, foreign key, references

[5 Jun 2012 17:53] Brandon Johnson
Description:
I would like a feature of the workbench that can automatically build the cascaded delete statement for deleting rows from a table which has multiple foreign key references.

Alfredo Kojima pointed out that such a request "could either generate a bunch of deletes for a specific row or generate a template where you specify the id of the top table row".

Personally, I believe a template would be more useful.

Thank you,

Brandon Johnson

How to repeat:
Build 2 or more tables using a constraint capable engine, and at least 1 Foreign Key reference between the tables.

Be able to use the tool to automatically detect the foreign key references and be able to build the delete statement to remove records from the top tiered table, which is referenced by the other table(s).
[13 Jun 2013 23:28] Philip Olson
Fixed as of the upcoming MySQL Workbench 6.0.2 public beta release, and here's the changelog entry:

New "Delete with References" and "Select with References" options were
added. The "DELETE" version will generate a series of "DELETE" statements
needed to delete a row from a table that includes rows from other tables
that reference it, recursively. The "SELECT" version allows you to
preview what rows would be deleted.

Thank you for the bug report.