[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: versioning a [small] MySQL database with svn?

From: Ed MacDonald <edmacdonald_at_hotmail.com>
Date: 2005-02-27 19:03:15 CET

Hook scripts are a server-side and working copies are client-side so a hook
script can't run "inside the working copy". If you really want to do this,
you would need to wrap the svn client. There has been talk of client-side
hooks on this list before but I can't recall what the consensus was.

In your scenario, every time I commit any file, you would dump the database
and try to commit it too just in case it has changed. It seems to me that
this would needlessly slow down the development process.

Are you talking about dumping just the schema or the data as well? Every
application I've been involved with required some "seed" data. In your
scenario you either have to manage seed data separately from the schema, or
end up checking in test/development data along with your schema thus
polluting your seed data.

Here is what works for me. I use three files for the DB (Schema.sql,
SeedData.sql, TestData.sql). Then every night during the build the DB gets
dumped/dropped/recreated before unit tests are run. The dump is a temporary
file just in case someone forgot to update the DB files in source control.

Hope this helps,

Ed

>
> Dear All,
>
>
> The documentation mentions start-commit & pre-commit hooks etc...
> See http://svnbook.red-bean.com/en/1.1/ch05s02.html#svn-ch-5-sect-2.1
>
> It seems to me that these hooks could be used to version a
> database. For instance, suppose that my SVN-managed project Foo
> contains not only files like Foo/main.c and Foo/foo.h but also a small
> MySQL database foo_db
>
> Then I would want to manage a Foo/foo_db.sql file, provided that
> before each commit the SubVersion system runs the command
> mysqldump foo_db > foo_db.sql
> inside the versioned working copy
>
> It seems to me that having this command inside my start-commit script
> is not enough. (and I would like to manage the script thru SVN and
> have it automagically installed as a hook).
>
> I believe that this is a common scenario that one want to version a
> file produced by a command (be it a RDBMS dump, or an HTTP client like
> wget, or a GDBM dump...) and to ensure that the SubVersion system
> produces this file (by running this command) before commits.
>
> I'm a bit surprised that such a scenario is not explicitly appearing
> in the documentation. Either I misunderstood something (most probably)
> or maybe something is lacking in the documentation or the SVN
> software.
>
> Any clues or insight please?
>
> Thanks for reading. Regards.
>
> --
> Basile STARYNKEVITCH http://starynkevitch.net/Basile/
> email: basile<at>starynkevitch<dot>net
> aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
> 8, rue de la Faïencerie, 92340 Bourg La Reine, France
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sun Feb 27 19:09:25 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.