Richard Davey wrote:
Hi all,

I know a lot of you use various means for PHP source control (CVS, SVN, etc), which is all well and fine, but how do you manage source control on your databases?

Say you've got an upgrade to a site, all of the new PHP files are controlled by SVN, so you can rollback at any time, but say the upgrade includes several key modifications to a MySQL table and perhaps the changing of some core data.

How (if at all?!) do you handle the versioning of the database and data itself, so you can keep both PHP and SQL structure in sync?

Cheers,

Rich
Rich,

This is a well-known problem that comes from the fact that the database is an infrastructure component rather than a source component. You would have the same issue if you were to upgrade the operating system software, for example.

What most people do is use their tool of choice to create the DDL/DML update scripts and put those under source control. To version the data you need to make database backups at well-understood times and grab the data files if appropriate. Rolling back a change is a matter of recovering the database and files to a point in time along with the sources.

I don't know of any management tools for this part of it. Most larger organizations have different people responsible for the database and web tiers, so a single tool won't do. Some folks are trying to use ClearCase automation to manage a lot of it, but it's still a work in progress...

In a smaller environment I would be inclined to create shell/whatever scripts to do the actual implementation. If you parameterize the connection/server details you can test the implementation in a QA environment before going live - less need for rollbacks that way. The shell scripts greatly reduce the chance of finger trouble which is key if your implementation is being done at some uncivilized hour or by rookies. If you want to truly embrace the New World, you can do all of this using Ant, which has built-in tasks for CVS/SVN as well as file movement, etc. It can also run shell scripts for the database stuff.

...Lori


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to