The Synchronize Model to Database feature allows you to compare a model with an existing database or schema, states the differences between their structures, and offers synchronizing the structures in model to the target connection.
Navicat provides a step-by-step wizard for you to complete the task:
In the Workspace window, choose Tools -> Forward Engineering -> Synchronize Model to Database.
Select the source model, database, schema, and select the target connection, database, schema.
Click Options and select the compare / advanced options.
Click Compare to show the differences between source and target objects.
Select the objects you want to synchronize.
Click Next to generate a set of scripts.
Click Start.
You can click the Options button to set the comparing options. The options depend on the connection server type and sort in ascending order.
Option |
Description |
Compare auto increment value |
Compare the auto increment values of tables. |
Compare character set |
Compare the character sets of tables. |
Compare checks |
Compare check constraints. |
Compare collation |
Compare the collations of tables. |
Compare definers |
Compare the definers of views. |
Compare excludes |
Compare exclusion constraints. |
Compare foreign keys |
Compare the foreign keys of tables. |
Compare functions |
Compare function and procedure objects. |
Compare identity last value |
Compare the identity last values of tables. |
Compare indexes |
Compare table indexes. |
Compare materialized views |
Compare materialized view objects. |
Compare owners |
Compare the owners of database objects. |
Compare partitions |
Compare table partitions. |
Compare primary keys |
Compare the primary keys of tables. |
Compare rules |
Compare rule objects. |
Compare sequences |
Compare sequence objects. |
Compare sequence last values |
Compare the last values of sequences. |
Compare storage |
Compare table storages. |
Compare table options |
Compare other table options. |
Compare tables |
Compare table objects. |
Compare triggers |
Compare table triggers. |
Compare uniques |
Compare unique constraints. |
Compare views |
Compare view objects. |
Drop with CASCADE |
Drop the dependent database objects with the CASCADE option. |
Identifier Case Sensitivity |
Ignore or consider the case of identifiers when mapping, or use the server default setting. |
After comparing structures, the tree view shows the differences between the source and target databases or schemas. Check the objects you want to apply to the target. You can expand the objects to view the detailed structure.
You can choose to group the objects in the tree views by object types or operations by selecting Group by Object Type or Group by Operation.
Operation |
Description |
|
Object exists in both source and target databases/schemas, but they have different definition. The target object will be modified based on the source object. |
|
Object does not exist in the target database/schema. It will be created in the target. |
|
Object does not exist in the source database/schema. The target object will be deleted. |
|
Object exists in both source and target databases/schemas and they have identical definition. No operation will be applied. |
When you select an object from the comparison results, the DDL Comparison tab displays the statements for that object from both the source model and the target database side by side. Any differences in the statements, such as added, modified, or removed fields, are highlighted for quick identification.
Furthermore, the Deployment Script tab shows the specific scripts that will be executed on the target database to apply the selected changes.
You can view all scripts that will be executed in the target database in the Deployment Script tab.
Deployment Options Button |
Description |
Deployment Options |
Continue on error - Ignore errors that are encountered during the execution process if necessary. |
Reorder Script |
Open the Reorder Script window to rearrange the order of the scripts. |
Open Script in Query Editor |
Open a new query window and display the scripts. |