Welcome Guest, Not a member yet? Register   Sign In
How do you track your DB in source control?
#11

[eluser]jedd[/eluser]
[quote author="BrianDHall" date="1256853820"]
So I finally put in a few minutes to get my latest project into source control, and it occurred to me that keeping up with differences in database schema (to say nothing of content) isn't handled with source control at all.
[/quote]

My database schemas are handled by source control.

All my table creates and inserts are stored in a bunch of files, located (for want of a better place) in assets/schema/

Files are called things like CREATE_site.mysql, INSERT_site.mysql - and there's a CREATE.mysql that sources all the CREATE_* files (and an equivalent one for INSERTs) - such that I can recreate my database with one command (source CREATE.mysql) and re-populate it with my test data with another.

This works really well for me because I'm not afraid of using a text editor to design my schema, or to prepare my test data. It might be also because I don't have hugely complex test data - but I can't see this approach becoming unwieldy even on reasonably large sets of data.

The files are all pulled into git - so as long as my commit annotations make sense, it's easy enough to track changes. Using something ilke bisect is trickier, of course, but no trickier than any other method would make tracking down a particular database change.




Theme © iAndrew 2016 - Forum software by © MyBB