Good day. There is a standard database in SQL format. Is it possible to make a script that would compare the structure of the standard database with the structure of the site database and, if necessary, produce a comparison report and generate correction requests?

Preferred PHP script

  • Is it possible to deploy a reference database? To compare not a SQL dump, but two databases? - cheops
  • Yes, there is, if necessary. - Pavel Zhukovsky
  • @PavelZhukovsky to you for the structure b.d. need or for data. The answer to the question is possible. - Naumov
  • I need to check the structure of the base. - Pavel Zhukovsky

1 answer 1

I use a bunch of DbForgeStudio and WinMerge) In the first one I create a script for creating a structure, and the second one shows where the changes are.

  • This is good, but you need a script that I can execute on the server .. PHP or SH is desirable - Pavel Zhukovsky
  • With sh then it will be easier, but here it is not strong. In the win environment, I used the following to create the structure: mysqldump --no-data - u USER -pPASSWORD DATABASE> /path/to/file/schema.sql - Jack Black
  • And how would you be able to set a ban on changing the structure of a table or database by setting the correct privileges to the user or scripts that you work with. Then the comparison with the standard is not needed. - Jack Black
  • The question is not how to prohibit initially, but how to check and correct it. The ban option is not appropriate. - Pavel Zhukovsky