Bug #12653 Cannot Insert a New Column Between 2 Columns in the GUI
Submitted: 18 Aug 2005 17:02 Modified: 19 Sep 2008 12:29
Reporter: Kimbo Mundy Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Query Browser Severity:S4 (Feature request)
Version:1.1.10 OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any

[18 Aug 2005 17:02] Kimbo Mundy
Description:
In the MySQL Table Editor, you can only add new columns at the end.  If you want to put the column between 2 existing columns, using the GUI, you're out of luck.  (This makes using the ActiveRecord library in Ruby on Rails harder.  See "Rolling with Ruby on Rails" at <http://www.onlamp.com/lpt/a/5546>.)

How to repeat:
1. In the "Schemata" tab of the main window, choose "Create New Table" from the menu.  This opens the MySQL Table Editor.
2. In the "Table Name" field, enter "recipes".
3. Double click in the column name field and add a column named "id".
4. Double click in the column name field at the end and add a column named "title".
5. Double click in the column name field at the end and add a column named "instructions".  Change its Datatype to "TEXT".
6. Click "Apply Changes, and Click "Execute".
7. Click "Close".
Now pretend you want to add a column named "date" after "title", and you want to use the GUI, not type SQL.

Suggested fix:
Possible solutions include:
1. Adding an Insert menu choice, in addition to "Delete Table Columns" on the "Column and Indices" menu
2. Allowing drag and drop of column names in the "Column and Indices" list
3. Having "Move Up/Down" buttons in the Column Details tab.
4. Allowing drag and drop of column names in the "Schemata" tab in the main window.

It seems to me that #1 and #3 would be the easiest.  I'm not sure that #4 would be a good idea; it might be too easy to do by accident.

As a workaround, I've been doing:
1. Add the new column at the end of the "Columns and Indices" tab of the MySQL Table Editor
2. Set the new column's properties
3. Click "Apply Changes"
4. Select & copy the SQL that appears in the Confirm Table Edit window
5. Click "Cancel"
6. Click "Close"
7. Click "Discard"
8. Paste the SQL into the query area
9. Edit the "... AFTER `<last-column-name>`;" to change to the appropriate column name
10. Execute

Please let me know if there's a simpler workaround.
[19 Sep 2008 12:29] Susanne Ebrecht
This is a duplicate of bug #6485
[27 Sep 2016 1:15] David Refoua
Duplicate of: Bugs #6485 #9043 #12064 #12653 #14608 #16909 #25784 #36236