Fork Your Application's Data (Not Just Your Code)
postgres.heroku.com
postgres.heroku.com
I'd love it if they found a way to link up your database to a repo, so that it could track/rollback changes easily as switching branches (I guess an sqlite db might work, but it's not perfect)
Any thoughts about which DB would be best suited for this? I wonder if it could be integrated with git somehow and make the whole process seamless.
Yes, but they happen. This seems like replying to someone drowning "well, you should have avoided swimming!"
You also make the assumption that we are using Rails (or some framework with migration support) -- many people won't have that luxury.
Finally, while the setup might be challenging (as in, figuring out a way to implement db tracking in git), I find it very curious that it would be much easier in anyones mind to do two tasks, doing all the rollbacks and switching branches, vs just switching the branch.
Git checkout -b "feature-1"
Git commit -am "Added feature 1, which included a migration"
Git checkout -b "feature-2-that-builds-off-feature-1"
Git commit -am "Added feature 2, which includes another migration"
Git checkout master
Broken (and with multiple migration files, even though I branched off for each new feature.)"Sorry, I can't look into your emergency production problem, I'm adding features to a blog."
It's not perfect and we still have to do work keeping in sync within our team, but it does the job locally.
This means your data in that db will diverge from the main branch slightly, but if that is too much of a problem and you need constant updates from live, you could look into migrations like those used by rails, which store your db changes so that they can be replayed on top of newer data from master and bring it up to the new schema. It's quite easy to setup a bare bones migration system using plain SQL migration files and some scripts if this is a problem you see often.
I often work with several branches of code in rails, and it's not a big problem, you just need a system for keeping the data in sync with the code.
GitHub is a documented example (and I happen to deploy branches daily too :-):
Yep, look like not as easy I think at the start of the reply...
http://mislav.uniqpath.com/rails/branching-the-database-alon...
This way you can enable a branch-specific database (if needed) and switch back and forth during the day if you need it.
One could somehow easily adapt that for another development framework, though!
I'm not sure if technically its the best term to use, but it does sound cool.
Without the ability to merge, shouldn't it just be called 'copying'
https://postgres.heroku.com/dataclips
I'll have to wait for them to become SafeHarbor compliant before using them, though (in progress!).
Isn’t that the advantage of Perforce?
http://www.perforce.com/product/product_features/perforce_st...
Last time I checked (for MySQL) it was possible, but not really recommended/wide-spread. Does anyone have practical experience with Postgres (and Heroku)?