3.4. Synchronization
Synchronization compares a model with a live database and lets you choose how to reconcile their differences.
Unlike 5.2. Model Deployment, synchronization is bidirectional. For each change, you can choose the model or the database as the source:
- Model → Database — apply the model structure to the database.
- Database → Model — update the model from the database structure.
Synchronization is an interactive GUI operation. It is useful when working with existing databases, developing locally, or bringing a model up to date with a database environment.
For automated deployment through GitLab, GitHub Actions, Jenkins, or other CI/CD systems, see 5.2. Model Deployment.
Synchronization can be started at three scope levels: database, schema, and table. The selected object determines the scope of the synchronization.
The first step the synchronizer will take is to load a list of schemas and tables and then prompt you to select specific objects to synchronize within the scope. The following example starts synchronization at the database level.
At this level you will have the opportunity to select the schemas to synchronize.

You can exclude individual tables from the synchronization process or, conversely, select tables that will be synchronized.

Please note that the first stage is a selection from the real structure of the database. If the model contains objects (tables, schemas) that are not in the database, they will be offered for addition only at the next stage.
After selecting the required objects, OrmFactory will load the detailed structure of the tables. These are columns, primary key, foreign keys, indexes and unique constraints. You may notice a progress bar appearing if the structure is large enough.

In this window you need to select the changes you need. The first column describes the object of changes, the second shows its state relative to the model, and the third - relative to the DBMS.
For each change, you can choose the model or the database as the source. If you choose the model, the database will be changed. If you choose the database, the model will be changed.

The selection works hierarchically. By selecting a table, you select all its contents, by selecting a schema - all tables, by selecting a database - all schemas.
The gray icon in the first column will change depending on your choice. If the choice was made in favor of the model structure, it will become "A", if in favor of the DBMS, then "B". Where there was a mixed choice, the icon will become "AB".
It is not necessary to select each item. Unselected items will remain with a gray icon and the changes will not be applied anywhere.
If you have selected changes that change the structure of the DBMS, then after clicking "OK" OrmFactory will prompt you to check the DDL changes. All changes to the DBMS structure are subject to user confirmation, this is one of the application rules.

In our case, this is the creation of the "test" table. You can add to the DDL, correct it, or cancel the operation by closing the window.
OrmFactory can detect likely table and column renames automatically. When a rename is detected, it is shown as a rename instead of separate drop and add operations. Detected renames can be overridden through the context menu.