I've started using Mercurial for version-controlling my Drupal project source files (I'm both a VCS and Mercurial newbie). However, the database is still "version-controlled" using a directory of dated .sql.gz files.
What I want is to have a single database dump file somewhere within my repository, that would be overwritten with a current dump when the database changes, and imported into the database when I want to rollback to another version.
I did it manually, and it worked. But what I'd really like is something that does the dumping/loading automatically on each commit/update. I'd really prefer that it would hook into Mercurial than being something external like a makefile that first dumps the database and then commits, since I like working with TortoiseHg's tools, and I don't feel like having another script to run.
Now, it seems that something like an mysql .... < dumpfile.sql
on an update
hook would be an easy way to load the database dump after each update. But what about the automatic dumping?
There was a similar question about SVN's pre-commit hook, and the accepted answer was that it's probably a bad idea. Does it apply to Mercurial? Maybe another hook (prechangegroup
?) would work?
EDIT:
I should point out that I'm using it by myself, on my local machine. It shouldn't scale beyond a single user.