Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automating Red gate Source Control DB Linking and Commit to SVN

Tags:

svn

redgate

We have a requirement for which we want to have Red Gate Source Control as a part of the Automated Interface.

We would like to programatically Link the Required Database and do Commit for the Changes to the Database.

Is this possible? If yes, which api should we use?

like image 923
Bandita Avatar asked Nov 02 '22 17:11

Bandita


1 Answers

I know this question is old but I'm doing exactly what you are describing.

I have a job that runs every X minutes and puts the current state of the database into version control (for us it's mercurial but you can achieve exactly the same thing with git or whatever).

cd c:\data\SourceCodeDirectory
hg pull
hg update
if not exist "c:\data\SourceCodeDirectory\databaseName" mkdir "c:\data\SourceCodeDirectory\databaseName"
cd "c:\Program Files (x86)\Red Gate\SQL Compare 11"
sqlcompare /s1:DBServer /db1:databaseName /scr2:"c:\data\SourceCodeDirectory\databaseName" /synchronize

cd c:\data\SourceCodeDirectory\databaseName
hg add
hg commit -m "Database Changes" -u DatabaseSchemaUser
hg push

Any changes made to the database will be in version control as soon as this job runs.

like image 74
chrismay Avatar answered Nov 08 '22 11:11

chrismay