Hacker News new | ask | show | jobs
by sethreno 4474 days ago
I prefer to think of db version control and db migrations as two separate things.

Version control achieved by keeping the SQL scripts to create the database in your VCS along with the code that depends on it.

Migration scripts are created later as a pre-deployment step. I prefer not to store these scripts in VCS because in my experience they are typically run once and never used again. There are several tools that can generate the migration scripts by comparing two schemas e.g. dev-->prod.

I wrote an open source command line tool that can be used to create VCS friendly create scripts from a SQL Server database. It's on github at https://github.com/sethreno/schemazen#schema-zen---script-an...

Also, here are a few tools that I've used to generate migrations scripts: * http://opendbiff.codeplex.com/ * http://www.sqldbtools.com/Tools.aspx?ProductId=1 * http://www.red-gate.com/products/sql-development/sql-compare...