Bug #92269 VISIBLE keyword in create shema SQL
Submitted: 3 Sep 2018 5:02 Modified: 14 Sep 2018 7:15
Reporter: ivan kalinic Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S7 (Test Cases)
Version:8.0.12 OS:Windows (Microsoft Windows 7 Enterprise Service Pack 1)
Assigned to: CPU Architecture:Any
Tags: WBBugReporter

[3 Sep 2018 5:02] ivan kalinic
Description:
----[For better reports, please attach the log file after submitting. You can find it in C:\Users\eivkali\AppData\Roaming\MySQL\Workbench\log\wb.log]

when using Database shema transfer wizard, i allways get errors because in new version of Workbench the "VISIBLE" keyword has been added. How to prevent this from happening:

WARNING: Error executing 'CREATE TABLE IF NOT EXISTS `ohs`.`authorized_users` (
  `id` INT(6) UNSIGNED NOT NULL AUTO_INCREMENT,
  `signum` VARCHAR(256) NOT NULL,
  `role` INT(2) UNSIGNED NOT NULL,
  `first_name` VARCHAR(64) NOT NULL,
  `last_name` VARCHAR(64) NOT NULL,
  `created_at` DATETIME NULL DEFAULT NULL,
  `created_by` VARCHAR(128) NOT NULL,
  `updated_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` VARCHAR(128) NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE INDEX `id` (`id` ASC) VISIBLE)
ENGINE = InnoDB
AUTO_INCREMENT = 1688
DEFAULT CHARACTER SET = utf8'
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VISIBLE)
ENGINE = InnoDB
AUTO_INCREMENT = 1688
DEFAULT CHARACTER SET = utf8' at line 23.
SQL Error: 1064

How to repeat:
    CREATE SCHEMA IF NOT EXISTS `ohs` 
- Creating table ohs.authorized_users
Execute statement: 
    CREATE TABLE IF NOT EXISTS `ohs`.`authorized_users` (
      `id` INT(6) UNSIGNED NOT NULL AUTO_INCREMENT,
      `signum` VARCHAR(256) NOT NULL,
      `role` INT(2) UNSIGNED NOT NULL,
      `first_name` VARCHAR(64) NOT NULL,
      `last_name` VARCHAR(64) NOT NULL,
      `created_at` DATETIME NULL DEFAULT NULL,
      `created_by` VARCHAR(128) NOT NULL,
      `updated_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
      `updated_by` VARCHAR(128) NULL DEFAULT NULL,
      PRIMARY KEY (`id`),
      UNIQUE INDEX `id` (`id` ASC) VISIBLE)
    ENGINE = InnoDB
    AUTO_INCREMENT = 1688
    DEFAULT CHARACTER SET = utf8
[14 Sep 2018 7:15] MySQL Verification Team
Hello ivan kalinic,

Thank you for the report.
It seems you are connected to MySQL Server version < 8.0 and WB Preferences: Modeling: MySQL is set to 8.0.x,  by default "Visible" checkbox is checked and thus when you are trying to forward engineer then seeing "VISIBLE" keyword(and INVISIBLE if unchecked). Could you please set WB Preferences: Modeling: MySQL to 5.7 or 5.6? Please let me know if you are still seeing this issue even after changing. Thank you.

regards,
Umesh
[4 Oct 2018 10:39] Jesper Hansen
My source is mysql 5.5 and my destination is mysql 5.7. 
In WB Edit/Preferences/Modeling/MySQL:
Default Target MySQL Version: 5.6.30 

And that also generates the VISIBLE keywords to indexes
[6 Jan 2019 4:31] Rick James
There are a 'lot' of questions on the forums about the syntax error caused by `VISIBLE`.  Since the default it `VISIBLE`, please remove it from the output.  This will please a 'large' number of Workbench users.
[12 May 2020 12:19] MySQL Verification Team
Related FR - https://bugs.mysql.com/bug.php?id=95804
[14 Oct 2020 18:54] Brian Plunkett
This bug should be *reopened*!  The code to render the index creation statements properly uses the "Default Target MySQL Version" preference correctly in the SQL Editor, but not in the Model.  What the user sets in "Preferences" -> "Modeling" -> "MySQL" -> "Default Target MySQL Version" doesn't matter as this value is being ignored in the Model tool.  Therefore, if your target database is a version prior to v8.0.12 (i.e. when the keyword was introduced), you'll experience the error.
[9 Nov 2020 12:57] André Santos André
hi guys, to avoid the error it is necessary to uncheck the "Use Defaults from global settings" checkbox in [ model -> model options -> MySql ], and then choose "Target MySql Version" 5.6.30 ... it worked for me ...
[4 Mar 2021 23:23] Debashis Paul
Can we know the solution workbench 8.0 with .changing the default model target 5.6 , 5.7 doesn't matter and its appending the VISIBLE against index. this is STILL not working .