We keep our mysql schema files in source control. We keep current base and delta files, and whenever a new versio开发者_开发技巧n is released, we take a delta files, merge them into base, clear them, and create appropriate migration scripts for production data.
We have a good enough set of scripts to do this. My question is - is there a 3rd party I can utilize to support this process, instead of our home grown scripts?
Note - I'm looking for a tool that doesn't require me to change my entire development process. The tool should not care if I'm developing a Ruby/Java/.Net application.
Is this what Liquibase does? Not using it personally but I think one of the other departments in the company is. Although it might be overkill for what you're looking for.
Try this: http://bitbucket.org/idler/mmp/wiki/Home Writen in PHP-5.3 and not care about what you use in your project.
Generate migration scripts (php-classes) and perform migrations.
(excuse me, if my English is not fine )
I started using SQLyog to get database diffs, it has a great GUI, but I haven't gotten around to automating it w/ scripts yet.
Ruby on Rails does this with it's ActiveRecord Migrations. You might take a look at their source. Also google database migration tools.
Rails takes quite a different approach. Instead of generating migration scripts from the schema deltas, you write the migration scripts as you evolve the schema and apply them to the production database as required by the codebase.
Most of the software I've seen to managed db "migrations" are tied to a particular framework. Many of them are tightly coupled to the ORM abstraction layer they interface with. That may be okay if you only ever access data through the ORM, but that's not always the case. I've also run into situations where the ORM software want to control all of the schema which I don't want it to do because what I'm doing is creating views/tables that work in conjunction with an existing installation. That make the ORM a no-go and as a result the migration lib that relies on that ORM.
As a result I usually have enumerated *.sql
files that get evaluated in order to produce the schema. I also typically use some templating lib to share idioms, standard prologue, etc.
If you're looking for a tool to help you generate the deltas, MySQL Compare should be helpful. It's entirely free to use while in early access.
http://www.red-gate.com/MessageBoard/viewtopic.php?t=11053
精彩评论