Bug #73644 "Synchronize with any source" will build buggy script on column rename
Submitted: 19 Aug 2014 13:49 Modified: 13 Nov 2014 1:09
Reporter: Claus Overbeck Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:6.1.7.11891 OS:Linux (Ubuntu 14.04 LTS)
Assigned to: CPU Architecture:Any
Tags: column mapping, column rename

[19 Aug 2014 13:49] Claus Overbeck
Description:
I tried renaming a column and export an ALTER script for using with flyway.
I used the "Synchronize with any source" method and set the column mapping form the old name to the new name.
The resulting script contains:
ALTER TABLE `mydb`.`table1` 
CHANGE COLUMN `column2renamed` `column2renamed` VARCHAR(45) NULL DEFAULT NULL ;

The expected Result would be:
ALTER TABLE `mydb`.`table1` 
CHANGE COLUMN `column2` `column2renamed` VARCHAR(45) NULL DEFAULT NULL ;

How to repeat:
I have attached "schmema_V2.mwb", it has the column already renamed from column2 to column2renamed. Load this in the workbench.

Go to "Database->Synchronize with any source".

As source I select "Model Schemata"
As destination I select "schema_V1.sql" (see attachment).
For Send updates to select some no existing output file.

In the next steps for "Column Mapping" select "column2" to be mapped to "column2renamed".

The resulting script is:
ALTER TABLE `mydb`.`table1` 
CHANGE COLUMN `column2renamed` `column2renamed` VARCHAR(45) NULL DEFAULT NULL ;

The expected Result would be:
ALTER TABLE `mydb`.`table1` 
CHANGE COLUMN `column2` `column2renamed` VARCHAR(45) NULL DEFAULT NULL ;
[19 Aug 2014 13:50] Claus Overbeck
Version 2

Attachment: schema_V2.mwb (application/vnd.mysql-workbench-model, text), 4.85 KiB.

[19 Aug 2014 13:50] Claus Overbeck
Version 1

Attachment: schema_V1.sql (application/sql, text), 706 bytes.

[19 Aug 2014 14:21] Miguel Solorzano
Please check with latest release 6.1.7. Thanks.
[19 Aug 2014 15:25] Claus Overbeck
Also affects current 6.1.7.11891 release
[25 Aug 2014 14:47] Marcin Szalowicz
Thank you for the bug report.
[13 Nov 2014 1:10] Philip Olson
Fixed as of the upcoming MySQL Workbench 6.2.4 release, and here's the changelog entry:

Exporting an ALTER script using the "Synchronize with Any Source" wizard
after making "Column Mapping" (table name) changes would incorrectly
generate CHANGE COLUMN queries as "CHANGE COLUMN `newcolumnname`
`newcolumnname`" instead of "CHANGE COLUMN `oldcolumnname`
`newcolumnname`".

Thank you for the bug report.