Page 1 of 1

DB versioning tool

Posted: Thu Sep 17, 2009 11:43 am
by alex.barylski
I have started on a project with a new company. During the interview I was asked if I was aware of a tool similar to RoR that versioned DB tables, similar to SVN with source code.

1. What is this tool called?
2. Does something similar exist for LAMP?

Could I not use the same tool, regardlesss of whather it was done in Ruby or whatever?

Re: DB versioning tool

Posted: Thu Sep 17, 2009 11:50 am
by alex.barylski
Up until now I have basically just dumped the SQL into files and commited those files to SVN but it sounds as though this tool somehow versions the DB in a more elegant way, any ideas? I can;t find anything on Google regarding this tool?

Re: DB versioning tool

Posted: Thu Sep 17, 2009 11:57 am
by arjan.top
it's called migration, doctrine does support that:

http://www.doctrine-project.org/documen ... migrations

Re: DB versioning tool

Posted: Thu Sep 17, 2009 12:23 pm
by alex.barylski
Migrations, yes, that is it, I found a tool here: http://code.google.com/p/mysql-php-migrations/

Interesting :)

Thanks :)

Re: DB versioning tool

Posted: Thu Sep 17, 2009 10:12 pm
by josh
I rolled a custom solution, it only migrates up, not down. Writing the "down" migration is extra effort & potential for issues. Basically I glob a directory and run the scripts, if its an .sql file it should contain sql, if its a .php file I include it ( which may contain queries embedded in loops & conditionals for complex migrations )

I did a talk about writing your own, basically all you need is a table to store the version # and a version # in each script, there is a book called database refactoring in martin fowler's signature series that is "ok" ( most of this stuff is common sense once you start to grasp the idea )