version control for mysql database

version control for mysql database

am 29.09.2006 10:51:55 von hansyin

Hi,

That's my first time to send mail to this address for asking help.
Sorry for my poor english firstly.

My case is like this:
Many guys are using a mysql database, each guy has a database copy in
his own PC, they need to do some changes in their local database from
time to time. then all guys need submit the changes to the central
database for sharing.

Is there a good tool or good way to do version control of a database?
I'm thinking a very stupid way whicy is by mysqldump, but I suspect it
maybe will lost data in some special cases.

The stupid mysqldump idea is: I can use mysqldump to dump local
database to a txt file, then using subversion to do version control of
the txt file. After changing local database, each guy can run mysqldump
to dump his local database to a txt file, then commit it to a central
dump file repository, also they need update local dump file from
central dump file repository to get somebody else's changes. then they
can restore local database by updated dump file.

Maybe you will ask me why don't let all guys to share a central
database, the reason is it seems like very hard to do security control,
because all guys need to change same table in same database(only
different records), our current application does not have any security
control for the database. on the other hand, to do version control of
database, we can record all guy's change in an easy way, and we can
arrange a manager to review changing patch, it seems like a better way.

Another small question is : if two guys add some different records at
the same time, those different records will have same primary key(which
is INTEGER auto-incremented), althrough I can merge those new added
records into one file and try to restore all of them to database, but,
database will claim "duplicate id" error. So I'm thinking if there is a
switch which can control mysql to change the duplicated id to a
auto-incremented value and insert it to database automatically?

Thanks in advance!