Bug #77685 MySQL Workbench Forward Engineer generates a lot of empty COMMENT statements
Submitted: 11 Jul 2015 2:16 Modified: 21 Sep 2015 22:59
Reporter: Sergio Bobillier Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:6.3.4.0 OS:Ubuntu (14.04)
Assigned to: CPU Architecture:Any

[11 Jul 2015 2:16] Sergio Bobillier
Description:
When using the Forward Engineer SQL CREATE Script command to export a model the generated script produces a lot of empty COMMENT statements for all the fields and indexes even when no comment was specified, it produces a code like this:

    -- -----------------------------------------------------
    -- Table `mydb`.`Country`
    -- -----------------------------------------------------
    CREATE TABLE IF NOT EXISTS `mydb`.`Country` (
      `id` INT NOT NULL AUTO_INCREMENT COMMENT '',
      `name` VARCHAR(60) NOT NULL COMMENT '',
      `lat` FLOAT NULL COMMENT '',
      `lng` FLOAT NULL COMMENT '',
      `zoom` INT NULL COMMENT '',
      PRIMARY KEY (`id`)  COMMENT '',
      UNIQUE INDEX `name_UNIQUE` (`name` ASC)  COMMENT '')
    ENGINE = InnoDB;

It produces a lot of changes (on version control systems) when you export the model and replace an older version of it. Also it is kind of stupid, why all those comment statements if no comments were made.

How to repeat:
- Create a new model with a table on it, the table can be as simple or complex as you want.

- Choose the Forward Engineer SQL CREATE Script command from the file menu.

- Click next on the wizard until you get to the "Review SQL Script" step.

Suggested fix:
If no comments were made (comment fields are empty) then no empty COMMENT statements should be generated.
[12 Jul 2015 1:01] MySQL Verification Team
Thank you for the bug report.
[31 Jul 2015 11:21] Christopher Crossley
This also causes a problem when I try and synchronize the design to the database. It keeps generating the same script over and over again because of the empty comment. 

This is breaking a big piece of why I use Workbench. I make a change to the database design. Hit sync and it updates the database. I am now hand crafting the scripts again and having to remember lots of changes.

To me the severity whilst not show stopping dose impact on the tools usefulness and should be upgraded to a higher severity.

I am on Mac latest OS version
[7 Aug 2015 14:47] Alexandre Brassard Desjardins
I have to agree that this makes synchronizing really painful to use and it is probably the main feature I use on Workbench. I have to manually edit the generated scripts every time I want to make a modification, or create the script myself from the modified model.
[21 Sep 2015 22:59] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Workbench 6.3.5 release, and here's the changelog entry:

Forward Engineering would sometimes append "COMMENT ''" to field and index
definitions.

Also, in the documentation, this bug report was merged with MySQL Bug #77400.

Thank you for the bug report.