0

We have a database and its structure can be modified by several developers. Our task is to synchronize changes made to the structure between different database instances. Currently we do by creating database backup SQL script and using diff tools to find differences, then we manually apply those differences to all instances of database. I believe there must be some mechanism that allows doing it automatically. Does anybody know one? Maybe some VCS can do it? How do you do it? Any suggestions?

Max Koretskyi
  • 101,079
  • 60
  • 333
  • 488
  • 1
    Look at [this](http://stackoverflow.com/questions/225772/compare-two-mysql-databases) question. – marioosh Jan 23 '14 at 06:48
  • 1
    You may try to use migrations. That means all DDL/DML statements are not just applied to main instance, but also logged into some file consecutive (and, of course, order matters). Then just run current migration file on all other instances (since it will hold all consecutive changes, result will be precisely same as main instance) – Alma Do Jan 23 '14 at 06:50
  • 1
    MySQL has extensive replication facilities. I suggest you look into them. – user207421 Jan 23 '14 at 06:52
  • @EJP, can you provide a link where these facilities are explained? – Max Koretskyi Jan 23 '14 at 07:06
  • @AlmaDo, thanks, what do you mean by _logged into some file consecutive (and, of course, order matters)_? – Max Koretskyi Jan 23 '14 at 07:08
  • @Maximus this may be implemented in many ways. If you want exact copy, you may wish to set up replication (it's mentioned in comments above). But for DDL only statements, migration will be good decision. To do that, you have to log your DDL statements somewhere. I.e. prohibit direct DB changes and any change must be like: "DDL created" -> "Passed to migration tool" -> "Executed on DB" -> "If successful, added to migration file"|"If failed, rolled back" – Alma Do Jan 23 '14 at 07:12

0 Answers0