2

I am curious if there is a standard or open-source application that allows a small team of developers to share MySQL database update/modification scripts?

Right now all the developers have a VM with their own instance of a database, so there are no conflicts and each can have separate development environment. When one makes a DB change we add the SQL scripts to a SQL text file in SVN, which is then run by each dev in their own environment when necessary.

The issue that we are having is that when someone updates the file, the others run the script, and then we add additional changes. It gets very confusing and we get errors if there are ALTER table statements, etc.

We don't want to use DB replication because if one dev destroys their DB we don't want the others to be affected.

We use ExpressionEngine and I've noticed they use PHP to check/validate SQL updates, is that the direction we will need to go?

Anyone else deal with this issue? If so, what did you end up using?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
thiesdiggity
  • 1,897
  • 2
  • 18
  • 27

2 Answers2

0

Perhaps what you want is migration support.

Then, you put the migration code in whatever CVS you use and each team member migrates (i.e. runs the migration script) on their box, and this syncs all databases.

The framework I use (yii) supports it but I'm pretty sure there are some standalone solutions if you don't want to have to bring the whole framework over.

Felipe
  • 11,557
  • 7
  • 56
  • 103
0

A fairly simple solution is to have a directory, instead of a single file. Then each time a Dev makes a change, they add a "patch file" to the directory. Other developers can get their databases up to date by running any patches they haven't yet run.

This can even be automated by having a metadata table in the database to track which patches have been run and writing a script to run any that haven't.

Lorna Mitchell has blogged about some strategies to doing this:

http://www.lornajane.net/posts/2010/simple-database-patching-strategy

http://www.lornajane.net/posts/2012/taking-on-a-database-change-process

The comments are full or people recommending various tools to help with the process. Personally, I just have a fairly simple script and have no need for larger libraries, but your mileage may vary.

Brenton Alker
  • 8,947
  • 3
  • 36
  • 37