I am presently using SVN for my PHP projects. I believed I ought to get my database under version control too, but what's the easiest method to do this? Will I simply make a db-folder during my project in SVN, paste SQL changes right into a file known as from_1._to_2..sql and commit?

If you make changes for your database, you need to save individuals alterations in a migration, that you could then afterwards operate on other servers simultaneously you improve your code. However, you essentially got the best idea. You are able to write some tools to really make it more automated for instance version each file, after which produce a table like migration_version inside your database, that will retain the current version from the database. After that you can produce a migrate script which will run all of the migrations needed to obtain the database up-to-date.

Observe that if you would like bi-directional db versioning (to ensure that you are able to revert to previous db version too), you have to write the needed queries for your too for every version.

You will find also tome tools that may help you on paper the migrations, for example MySQLdiff

You are able to this short article concerning the subject http://techportal.ibuildings.com/2011/01/11/database-version-control/ You'll have more information and concepts how you can version control the DB structure.

You should use the MySQL Workbench tool.

The file produced using the modeling tool could esaly be saved under SVN. The tool enables you to definitely synchronise your database using the model in bidirectionnal way.

I just read relating to this on the different stack overflow page: http://www.liquibase.org/quickstart

The concept is:

All database changes are saved inside a human readable yet trackable form and checked into source control. - Liquibase.org top of the page

This is actually the original SO question: MySQL Version Control - Subversion

I am configuring it now, it appears just like a good find. Free, Apache 2. license and also the last update arrived on the scene October 2011 therefore it is not abandoned yet. The only real factor I do not like is the fact that it's Java but that is just my own prejudice.