Page 1 of 1

Schema integrity verification

Posted: Thu 12 Oct 2017 09:14
by zhekaus
During the database schema synchronization FOREIGN_KEY_CHECKS=0 is using.
That means, If I don’t import all the necessary tables, the schema may be incomplete.
Is there a way to check the the schema integrity to find all the missing foreign tables?

Looking forward for response,
Thanks in advance.

Re: Schema integrity verification

Posted: Thu 12 Oct 2017 17:30
by alexa
We will review this post and will answer you as soon as possible.

Re: Schema integrity verification

Posted: Wed 18 Oct 2017 15:24
by alexa
From the MySQL documentation, when setting FOREIGN_KEY_CHECKS=0, the table creation order does not depend on the foreign keys. Upon synchronization, all the objects should be created. You can check this by creating a test database and synchronizing it with the source one.

Also, you can use the 'Ignore foreign keys' synchronization option. In this case, the foreign keys will not affect the database synchronization. After that, you can exclude the option and create the foreign keys.

Re: Schema integrity verification

Posted: Thu 19 Oct 2017 05:56
by zhekaus
Thank you very much for the response.

I made the check on my own. In fact, it is not so difficult. All is needed is stored in information_schema.

PS. Btw, I think it’s a good idea to have such a verification as a dbForge feature.

Re: Schema integrity verification

Posted: Thu 19 Oct 2017 12:56
by alexa
In our previous reply we were referring to another our product which is dbForge Schema Compare for MySQL.

Please note that there is the 'Disable foreign keys' option on the 'Options' page of the data synchronization wizard of dbForge Data Compare for MySQL. This option adds

Code: Select all

 FOREIGN_KEY_CHECKS=0
at the beginning of the script and

Code: Select all

FOREIGN_KEY_CHECKS=1
at the end.