1

Is there a way to check the equivalence of two DDLs?

To describe the problem, I'm facing:

Got a mysql db and a squeryl-based app, that works with it. I want to check, if the db is in the correct state (according to the DDL, genereted by Schema.printDdl) before (or while) app startup (if someone forgot to create a patch or something).

Any ideas, how this can be accomplished?

George
  • 8,368
  • 12
  • 65
  • 106
  • 2
    We use `mysqlexport --no-data` and diff the output with the file. – Konerak Apr 12 '12 at 08:40
  • @Konerak the problem here is that `mysqlexport` and `Schema.printDdl` will probably generate very different ddls: order of statements, spaces/tabs/returns/aditional parentheses/etc. Is there a way to smartly programmatically check if they are essentially the same? – George Apr 12 '12 at 08:59

2 Answers2

1

I use SQLyog for that purpose. It has Schema synchronization tool which you can also use for just comparing the structure of two databases.

There are also other similar tools, e.g. TOAD for MySQL.

Dmytro Shevchenko
  • 33,431
  • 6
  • 51
  • 67
0

You can use a database project functionality in dbForge Studio for MySQL.

  1. Create a project and add existing file (SQL script).
  2. Assign database connection and click on 'New Schema Comparison' from the project popup menu.

It will help you to compare, find differences and synchronize a database project (SQL script in your case) with a required database.

Devart
  • 119,203
  • 23
  • 166
  • 186