Bug #57465 Implement drag/drop moving of columns from one table to another on the diagram
Submitted: 14 Oct 2010 18:50 Modified: 15 Oct 2010 4:09
Reporter: Craig Fowler Email Updates:
Status: Verified Impact on me:
Category:MySQL Workbench: Modeling Severity:S4 (Feature request)
Version:5.2.28 OS:Any
Assigned to: CPU Architecture:Any
Tags: diagram, refactoring, UI

[14 Oct 2010 18:50] Craig Fowler
It would be useful (and cool) if Workbench would support moving of columns from one table to another on the diagram (all column metadata is moved across, becoming associated with the destination table).

At the moment there appears to be no functionality that achieves this, not on the diagram or in the 'table editor' pane (via something like "cut column", "paste column").

My main use case for this is when using Workbench to refactor/normalise database schemata - it would be very useful to be able to create new tables and then drag drag existing columns to them to speed up the task.

The only possible stumbling point I see here is if the column being moved is part of a multi-column index or FK constraint/relationship on the source table.  Perhaps a dialog would need to be shown in this instance to warn the user:

Hey, you're about to break a multi-column index, do you want to:
* Move the other columns involved in this index too (possibility of a cascading effect if they are involved in other multi-column indices)?
* Remove this column from the multi-column index?


Hey, this column was involved in a relationship, do you want to:
* Break the relationship?
* Move the relationship along with the column?

How to repeat:
NA - feature request

Suggested fix:
At the moment any drag action anywhere on a table in the diagram view is interpreted as moving the table to a new location on the diagram.  Three possible ways to implement this feature as a drag/drop action:

* Use a modifier key so that if dragging a column whilst that modifier key is held down (ctrl-drag or something like that?) then instead of picking the table up and moving it on the diagram, the column is picked up and can be dropped onto another table (possible clash with OS-specific functionality, for example in many Linux-based GUI environments, alt-drag means "reposition application window").

* Show small drag handles on the columns so that if dragging using these handles, the column is grabbed and can be dropped on another table.  Dragging from anywhere else on the table object is a normal move operation.

* Add a new toolbar item for "Refactoring mode".  It would toggle whether drag/drop means reposition in the diagram or whether it picks up columns and moves them to other tables.  Perhaps in the future this could also toggle other functionality too?  (I'm thinking of other potential future functionality like dragging a table title over another table to do things like "remove this table and move all of its columns into [destination table]")

Finally - it could be even more cool if there was a behavior so that if (when a column is dropped using this drag/drop functionality) - if it is dropped on diagram whitespace (instead of another table) the user is prompted:

Do you want to create a new table to contain this column?
* Yes, create a new table and add this column to it.  Also, create a [dropdown list of relationship types, including "none" selected by default] relationship to [the source table that the column came from]
* No thanks, just cancel the column move operation

That would make refactoring - and normalisation especially - a total breeze, making it really quick to break poorly-normalised columns out of their source tables into a new table, with a relationship back to that source table.
[14 Oct 2010 18:52] Craig Fowler
Oops, was meant to be a feature request ;)
[15 Oct 2010 4:09] Valeriy Kravchuk
Thank you for the feature request.
[18 Oct 2010 18:31] Valeriy Kravchuk
Bug #57535 was marked as a duplicate of this one.