It is possible to synchronize a model in MySQL Workbench with a live database. By default, the synchronization process will change the live database to be the same as the model, but this is configurable during the synchronization process.
MySQL Workbench enables control over the direction of synchronization, and which objects to synchronize, in a completely flexible way. You can choose to synchronize only certain tables, enable synchronization to the live database only, enable synchronization from the live database to the model only, or a combination of directions. In effect you have complete control as to whether the synchronization is unidirectional or bidirectional, and which objects exactly are subject to synchronization. This is all controlled in the Select Changes to Apply page of the synchronization wizard.
In the preceding example, the live database consists of
table1, table2 and
table3. In MySQL Workbench an additional table,
table4, has been created, along with a
relationship between it and table3. Further,
table5 exists in the live database, but not in
the model. The actions that are configured to occur would result
in table3 being altered (to include the
relationship with table4),
table4 being created and
table5 being dropped, in the live database. It
is possible to reconfigure this, though.
The next example shows how the direction of synchronization can be changed.
In this case, the synchronization direction has been changed so
that rather than the default action of table5
being dropped from the live database, it will be incorporated into
the MySQL Workbench model.
For convenience, the wizard provides three additional buttons to
enable synchronization directions to be applied to a group of
selected changes. The Update Model button
causes the selected changes to be applied only to the model
itself. In the following example, table7 would
be added to the model.
The Ignore button causes the selected changes to be ignored. No synchronization will take place for those changes. In the following example, no changes would take place.
The Update Source button causes the
selected changes to be applied only to the live database. In the
following example, table6 would be added to the
live database and table7 would be dropped from
the live database.
It is also possible to control individual changes by clicking the
arrows. Clicking an arrow causes it to change between the three
available synchronization directions: from model to source, from
source to model, or bidirectionally. In the following example,
table6 will be created in the live database,
and table7 will be created in the model.
