So I have an error, when I want to add a foreign key. I added the foreign key in MySQL Workbench with an EER Diagram Model. The lines workbench tries to add are:`
For anyone looking this, in the EER Diagram Model window you can set wich MySQL version want use to generate SQL script. Go to Edit, Preferences, then Modeling section, MySQL and set your custom MySQL version.
In MySQL Workbench, when you are connected to a server, click on "Server" from main menu and then "Server Status".
With "Version: X.X" go to your EER Diagram tag, click on "Edit" from main menu and "preferences", then in Modeling section "MySQL" set your custom MySQL version taked before.
Remove the VISIBLE keyword and run the code if its below mysql 5.7
i was using mysql version 5.5.62 .
commenting of the line
INDEX 'fk_CUSTOMER_BARBER_idx' ('BARBER_ID' ASC) VISIBLE,
did worked for me.
it can be for the current version of mysql against the default version workbench:
Change default targe version mysql in workbench:
references -> Modeling -> MySQL -> Default Target MySQL Version
Check Your MySQL version and update it in:
Preferences -> Modeling -> MySQL -> Default Target MySQL Version
My MySQL version is 5.7.21.