You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Jun Yin <ha...@gmail.com> on 2006/09/29 08:32:10 UTC

Request help for subversion

Hi,

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

I'm trying to use subversion to to version control of a mysql database.
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.
I cannot find a good tool to do version control for a database(if you know
one, pls tell me), so I'm thinking if 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 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.

My problem is:
1. when two guys add records at the same time, the added record will be the
last line of the dump file(same place of two local dump files in two guys
local PC), then subversion will think they're ***conflict***.   I cannot
find a way to handle this problem, I'm thinking if subversion has a switch
to do special control for the end of a file: if two guys add something in
the end of a file, just merge it, don't claim conflict.
2. Can I merge a change by diff file? currently, each guy just commit
changes by run "svn commit" command, this behaviour skiped the review step.
In future, I hope each guy only submit the diff file(patch) to the manager,
then manager can review it, if approved, then manager can merge the patch to
the repository. I readed the "svn merge" command help but cannot find an
answer.
3. the problem I mentioned before, Is there a good tool or another good way
to do version control of a database? the way by mysqldump seems like a very
stupid idea, and I also suspect it maybe will lost data in some special
cases.

Thanks in advance!



-- 
Rgds,

Hans Yin
Web: homeofhans.homeip.net
Email: hansyin@gmail.com
MSN: hansyin@hotmail.com
Skype: hans_yin_vancouver

Re: Request help for subversion

Posted by Russ <rs...@istandfor.com>.
Jun,

I'm not sure if a similar tool exists for mysql, but we've been pretty happy with red-gate's tools for sql server.  They have sql days compare which allows you to sync data changes and sql compare which allows you to sync schema changes.  Its not version control per se, but it gives you greater control then using nothing.  

Worst comes to worst, you can always switch to sql server express, which is free, and has liberal limitations.

Russ
Sent wirelessly via BlackBerry from T-Mobile.  

-----Original Message-----
From: "Jun Yin" <ha...@gmail.com>
Date: Fri, 29 Sep 2006 01:32:10 
To:users@subversion.tigris.org
Subject:  Request help for subversion

Hi,

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

I'm trying to use subversion to to version control of a mysql database. 
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. 
I cannot find a good tool to do version control for a database(if you know one, pls tell me), so I'm thinking if 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 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. 

My problem is:
1. when two guys add records at the same time, the added record will be the last line of the dump file(same place of two local dump files in two guys local PC), then subversion will think they're ***conflict***.   I cannot find a way to handle this problem, I'm thinking if subversion has a switch to do special control for the end of a file: if two guys add something in the end of a file, just merge it, don't claim conflict. 
2. Can I merge a change by diff file? currently, each guy just commit changes by run "svn commit" command, this behaviour skiped the review step. In future, I hope each guy only submit the diff file(patch) to the manager, then manager can review it, if approved, then manager can merge the patch to the repository. I readed the "svn merge" command help but cannot find an answer. 
3. the problem I mentioned before, Is there a good tool or another good way to do version control of a database? the way by mysqldump seems like a very stupid idea, and I also suspect it maybe will lost data in some special cases. 

Thanks in advance! 



-- 
Rgds, 

Hans Yin
Web: homeofhans.homeip.net: <http://homeofhans.homeip.net> 
Email: 
hansyin@gmail.com: <ma...@gmail.com>  
MSN: hansyin@hotmail.com: <ma...@hotmail.com> 
Skype: hans_yin_vancouver 

Re: Request help for subversion

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Sep 29, 2006, at 03:32, Jun Yin wrote:

> I'm trying to use subversion to to version control of a mysql  
> database.
> 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.
> I cannot find a good tool to do version control for a database(if  
> you know one, pls tell me), so I'm thinking if 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.

The problem is that a mysqldump does not convey information about how  
changes were made. For example, if you alter a table to add a new  
column, and you populate the new field with values, how did you do  
this? Did you manually input values in your INSERT statement, or did  
you use INSERT ... SELECT to get the values from other fields?  
mysqldump won't tell you. What (IMHO) you really need is a way to  
preserve the original SQL statements and send these up to the main  
database. And the only way I know of to do this is to have each  
developer write down (e.g. copy and paste into a file) the statements  
they want preserved. I don't think a tool can determine this for you,  
much in the same way that Subversion cannot determine for you whether  
you renamed a file or moved it or copied it or whatever, as explained  
in this FAQ entry:

http://subversion.tigris.org/faq.html#wc-change-detection


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org