Bug #104536 Workbench forward engineering retains removed column options like UNIQUE
Submitted: 4 Aug 2021 14:20 Modified: 5 Aug 2021 13:28
Reporter: Van Stokes Email Updates:
Status: Can't repeat Impact on me:
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:8.0.26 OS:Ubuntu (20.04.2)
Assigned to: CPU Architecture:x86 (x86_64)
Tags: column, forward, unique

[4 Aug 2021 14:20] Van Stokes
When forward engineering a database the removed column options are still being included in the SQL script that is being generated.

How to repeat:
1) Create a database table.
2) Add a column with a UNIQUE option (my case is VARCHAR(50)).
3) Save workbench.
4) Forward Engineer and check the script.
5) UNIQUE is on the column definition (as expected).
6) Now remove (un-check) the UNIQUE option from the column.
7) Save workbench.
8) Forward Engineer and check the script.
9) UNIQUE is STILL on the column definition (not expected).

The same applies with the UNSIGNED option.

Suggested fix:
I suspect GUI is not updating the table definition in memory. Correct the code to not retain the UNIQUE (or any) option when removed via the GUI.

You have to delete the column definition and re-create it to remove the phantom column option.
[4 Aug 2021 14:23] Van Stokes
Screen shot showing the UNIQUE option is un-checked

Attachment: screenshot-001.png (image/png, text), 151.68 KiB.

[4 Aug 2021 14:24] Van Stokes
Screen shot showing the UNIQUE option still present in forward engineering script

Attachment: screenshot-002.png (image/png, text), 262.44 KiB.

[5 Aug 2021 13:28] MySQL Verification Team
Hello Van Stokes,

Thank you for the bug report.
I tried to reproduce your issue on Ubuntu 20.04 with workbench 8.0.26 and followed exact steps but I am not seeing any issues at my end. 

Ashwini Patil