Blog

All you wanted to know about SQLyog’s Schema Comparison tool

All you wanted to know about SQLyog’s Schema Comparison tool
Developers and DBAs often compare and synchronize structures of their database objects (Tables, Views, Triggers, Functions, Events and Stored Procedures) from Development server to Production server and vice-versa. One can use a schema comparison / synchronization tool to synchronize database (DB) objects.

SQLyog’s Schema synchronization tool is simple and intuitive to use for comparing and synchronizing database objects. It comes with new looks and a Filter feature. Database objects’ comparison is now 100x faster.

SQLyog Schema synchronization tool

Using SQLyog, schema synchronization can be usually done in three easy steps:

schema synchronization process

  1. Choose the databases
  2. Pressing Compare will show differences between database objects
  3. Execute All button will execute the SQL statements to synchronize selected database objects.

Options provided in SQLyog to speedup comparison process are:

1. Hide and Ignore Object(s)

SQLyog has four Hide and Ignore Object(s) options, which hides database objects as stated:

  1. Identical
  2. To be altered in target
  3. To be created in target
  4. To be dropped in target

For example, if you want to see only those database objects that are to be altered, then simply keep “To be altered in target” option unchecked, and the rest checked.

Note: One can at most check three of these options at a time. With all four options checked, there is nothing left to be shown/ synchronized in tree-view.

2. Filter

From version 10.3 SQLyog has Filter in Schema Synchronization Tool. Now, instead of comparing all database Objects, one can easily filter out only specific database Object to be compared. Filter also identifies MySQL’s wildcard characters like ‘%’ and ‘_’. This feature will speedup the task of schema comparison as it is limited to selected database Objects. By default, filter is set to ‘%’, that means it’ll consider all database Objects for schema comparison.

If you wish to sync only a particular table, then specify name of the table in filter. For example, to sync structure of table “actor” from database sakila_copy in production server to database sakila in development server, enter into filter “actor”, select ‘Only Tables’ option. Tree-view will now only show the table “actor”.

Schema synchronization tool filter

Let’s take an important case into consideration. Say, to synchronize all tables that are used in WordPress, with prefix ‘wp_’, type “wp\_%” in filter. Notice that ‘_’ has been escaped with ‘\’ as ‘_’ is also a MySQL wildcard character. Doing this, shows only those tables that begin with ‘wp_’.

Schema synchronization tool with escape

3. Sync Only Tables or All Objects

SQLyog also gives you an option to sync either tables only or all database objects.

Note: For all these options to take effect you should set them before you start comparing databases. Otherwise, you will have to again compare databases after setting the options. These options are persistent across sessions.

For differentiating database objects to be synchronized, SQLyog has color coding. Color coding as seen in Source Database’s tree-view is:

color coding Source Database tree view

  • Green – to be created in Target Database.
  • Cyan – to be altered in Target Database.
  • Grey – to be dropped in Target Database.
  • Black – identical in both Source and Target Databases.

Note: Don’t get confused with Target Database’s Tree-view’s color coding, which is just an indication of what will be created/ altered/ dropped, if reverse sync is done.

The Schema Synchronization tool is a Power Tools feature present in SQLyog Ultimate and Enterprise editions. You can also download a trial copy.

2 thoughts on “All you wanted to know about SQLyog’s Schema Comparison tool

    • You can synchronize the schema for each database with the source using the steps as outlined in the blog. For synchronizing the schema of multiple databases you need to select each database individually from drop-down and then perform the comparison.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>