views:

78

answers:

2

Hi!

I've been looking for an easy and automated way to detect changes on my database structure so I can check them into subversion and be able to roll back to older versions etc.

Now I found phpMyVersion, which seems to do exactly that job. I didn't have time to look into it in great detail, but does anyone of you have some experiences with phpMyVersion?

Thanks, Sebastian

+2  A: 

First of all, check here. The version of the program is 0.1.1 and it's not been updated for 701 days. Does not inspire confidence.

Ólafur Waage
+3  A: 

I have solved this precise issue on our server using (My)SQL, Bash script and SVN.

The Bash script does the following:

  1. Perform a SVN update on a specific folder;
  2. Export the database to a SQL file;
  3. Commit the SQL file to SVN.

Simply have the script run using cron. We dump a backup to SVN every night at midnight.

cd /[PATH]/server_backup
svn --username [USERNAME] --password [PASSWORD] update --non-interactive
insert --skip-comments > database.sql
mysqldump [DATABASE] -u[USERNAME] -p[PASSWORD] --skip-extended-insert --skip-comments > database.sql
svn --username [USERNAME] --password [PASSWORD] commit --message "Server backup" --non-interactive
Paul Lammertsma
To avoid SVN conflicts, you could consider adding a line that marks the file as resolved prior to replacing it.
Paul Lammertsma
But this does a whole dump of the database. I would like to get diffs for single column changes etc.
Sebastian Hoitz
I can't think of a solution for that. The Bash script above really only serves to put daily versions of the database on SVN. In that sense, this won't really help you out unless you are prepared to view the diffs of the sql file and perform all changes manually. It's either that, or importing it and overwriting the existing database.
Paul Lammertsma