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?
DB versioning tool
Moderator: General Moderators
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: DB versioning tool
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
it's called migration, doctrine does support that:
http://www.doctrine-project.org/documen ... migrations
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
Migrations, yes, that is it, I found a tool here: http://code.google.com/p/mysql-php-migrations/
Interesting
Thanks
Interesting
Thanks
Re: DB versioning tool
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 )
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 )