DB versioning tool

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

DB versioning tool

Post 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?
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: DB versioning tool

Post 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?
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: DB versioning tool

Post by arjan.top »

it's called migration, doctrine does support that:

http://www.doctrine-project.org/documen ... migrations
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: DB versioning tool

Post by alex.barylski »

Migrations, yes, that is it, I found a tool here: http://code.google.com/p/mysql-php-migrations/

Interesting :)

Thanks :)
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: DB versioning tool

Post 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 )
Post Reply