Multiple MySQL Workbench Synchronizing issues

unknownymouse :

I just started using MySQL Workbench and I'm experiencing multiple issues while Synchronizing.

I modelled the schema using Workbench and Forward Engineered it and ran it successfully in the database server. Later edited a Trigger and tried to synchronise it with the database server

So I went to Database -> Synchronize Model...

enter image description here

I have only edited one trigger(just added +1 to an already existing variable in the Trigger) but as you can see it shows that all the tables must be changed/updated(with a little yellow exclamation mark). It shouldn't be right?

And when I click continue, I noticed in the generated script that it is deleting foreign keys and again adding them. enter image description here

And when I clicked on Execute, it is showing an error:

ERROR: Error 1064: 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 'Default Collation' at line 1

enter image description here

Also, it adds DEFAULT COLLATE Default Collation for all ALTER statements for schemas and tables, which is causing error 1064

ALTER SCHEMA `myschema`  DEFAULT COLLATE Default Collation ;

.....
.....

.....

ALTER TABLE `table1` 
COLLATE = Default Collation ;

ALTER TABLE `table2` 
COLLATE = Default Collation ;

ALTER TABLE `table3` 
COLLATE = Default Collation ;
....
....
....
....

MySQL Community Edition: 8.0.19

MySQL Workbench: 8.0.19

macOS: Catalina 10.15.3

I've researched on other SO posts about error: 1064 and many suggested to change the version. So, I've also changed the MySQL version in Workbench Model -> Model Options... -> MySQL -> Target MySQL Version: 8.0.19 but still the error exists. enter image description here

Am I missing something or doing it wrong?

I tried (the other way around) to synchronize model(as destination) with the database server( as source) to make sure at least the database server is as expected. So, when I did that, all the foreign keys are deleted in the EER Diagram.

I checked on the database server are there even foreign keys present using this post and everything is fine on the server.

SkrewEverything :

I don't know whether it's supposed to do like this or just a hack but the thing is, I got what I want for now atleast.

I used trail and error. So, I don't know why or how but it works.

Open the workbench, get the schema from the database server, edit the schema in your workbench and synchronize. This way even if someone changed on the server, you get the latest version of the schema.

Go to Database -> Reverse Engineer. It creates EER diagram from your database server schema.

Once you get the EER diagram generated, try to edit your changes and go to Database -> Synchronize Model... Now you only have the yellow exclamation mark before a table name which you have modified(instead of before all the tables as you said)

Also when I did this, there are no DEFAULT COLLATE Default Collation lines or foreign keys deletion and addition lines in the final script. The final script only contained which is required.

I hope it works for you too.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=23598&siteId=1