Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Version Control - Subversion

Wondering if it is possible to have a version control of a MySQL database.

I realize this question has been asked before however the newest is almost a year ago, and at the rate things change...

The problem is coming that each developer has apache/MySQL/PHP on their own computers to which they sometimes edit the database. Its rather inconvenient if they have to send an email to all the other developers and then manually edit the test servers database.

How do you deal with this problem?

Thanks

like image 421
user103219 Avatar asked Nov 23 '09 15:11

user103219


1 Answers

This is not a MySQL-related solution in itself, but we've had a lot of success with a product called liquibase. (http://www.liquibase.org/)

It's a migration solution which covers many different database vendors, allowing all database changes to be coded in configuration files, all of which are kept in Subversion. Since all configuration is kept in XML files, it's easy to merge other people's changes into the mainline script and it plays well with tags and branches.

The database can be brought up to the current revision level by running the "update database" command. Most changes also have the ability to roll-back a database change, which can be helpful too. I would recommend following the practice of making sure you get current before running the migration, as this would likely be easiest.

Finally, when it comes to a production delivery, you can choose to have all the database changes output as a full SQL script so it can allow DBAs to run it and maintain a separation of duties.

So far, it's worked like a charm.

like image 139
awied Avatar answered Sep 29 '22 15:09

awied