Domanda

I want to write the post commit hook to update the databases automatically on every svn commit..... and also I want to know any other way to perform the same task rather than post commit hook?

Thanks Naveen.

È stato utile?

Soluzione

I wouldn't use the post-commit hook - it runs while the developer is committing to SVN, and you really want your commits to be as fast and painless as possible. That makes it hard to deal with inevitable situations where the database action is slow, or fails, or can't connect to the database or whatever.

Instead, I'd look at setting up a continuous integration server to monitor SVN, and run whatever scripts you want to for each commit.

As for "how" - either write a native application to run the database query, passing in the parameters on the command line, or use whatever scripting language your platform supports to execute the database queries. Powershell on Windows, pretty much anything on *nix...

Altri suggerimenti

Assuming you have CI, have the database changes applied as part of you build. Have a good look at LiquiBase. It's designed to do exactly this task and is open source. I've used it and wouldn't use anything else.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top