How to Compare SQL Database Schemas

In Luna Modeler you can connect to your SQL database and easily create a model with an ER diagram. You can then use the model and compare it with the original SQL database or any other SQL database to easily see the differences and generate a report.

This way you can easily find out:

  • what’s changed in the original database, if compared to the same database
  • how the other database is different from the model, in case of comparison with another database
  • how you have changed the data model in Luna Modeler.

Comparing SQL Databases in Luna Modeler

If you want to compare two different databases, create a connection for both of them. Once you have made the connections, connect to the first database and create a model with an ER diagram.

A data model prepared in Luna Modeler. This model will be used for SQL database comparison.

Now click on the Advanced button in the main toolbar. A sub-menu will appear from which you can select either Generate synchronization SQL or Update project from database.

Advanced button in Luna Modeler.

If you select Generate synchronization SQL, a window will appear in which you select on the right side the other database connection you created earlier. Click the Load Database and Detect Differences button to start the comparison process.

Settings and detection of database schema changes in Luna Modeler data modeling tool.

After the comparison is completed, you will see a list of changes.

The result of SQL database comparison. A list of detected differences is displayed.

Generating Documentation

To generate documentation, click the Report button in the Synchronization window.

Report button on the Synchronization form in Luna Modeler.

Select the path where the report should be saved and generate an HTML report with a list of changes. The report can be generated in multiple themes. Here you can see the dark theme.

HTML report generated by Luna Modeler. The report contains the result of SQL database schema comparison.

Schema Synchronization

If you are interested in synchronizing the database schemas, your next actions depend on the actual scenario. For example, if you have changed the structure in database A, you can update your model created in Luna Modeler using the Model Update feature. Then you can compare the updated model with database B and generate a synchronization SQL script.

Delta scripts for database schema changes

In other cases, it is simply enough to perform a project update or generate an SQL script for the original database.

Note: Synchronization script generation is available for MySQL, MariaDB and SQLite for now. Support for other databases is under development.

Get started today and try Luna Modeler

Download

#

DATA MODELING TOOLS
DRAW Diagrams and
GENERATE Scripts
Download data modeling tools
Blog Categories
Blog by Platforms