Red Gate forums :: View topic - Team City plugin drops database
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Source Control 3
SQL Source Control 3 forum

Team City plugin drops database

Search in SQL Source Control 3 forum
Post new topic   Reply to topic
Jump to:  
Author Message
nforss



Joined: 16 Oct 2012
Posts: 2

PostPosted: Tue Oct 16, 2012 8:01 am    Post subject: Team City plugin drops database Reply with quote

Hi,

I've been trying to get SQL Source Control to work together with Team City using the plugin provided by Red Gate. My problem is that even though the plugin configuration explicitly states that the runner wont create the database for me, it first drops the db and then tries doing exactly that. (The sql server user account does not have permission to create a new db.)

The error message in the Team City log looks like this

Code:

[09:44:47]Step 12/17: Build database from source control (Red Gate (SQL Server))
[09:44:47][Step 12/17] Starting: C:\TeamCity\buildAgent\plugins\RedGateSQLServer\assets\sqlCI.exe /scriptsFolder=Database /databaseServer=SERVER /databaseUserName=USERNAME /databasePassword=PASSWORD /databaseName=staging /packageRepository=null /packageId=staging /packageVersion=243
[09:44:47][Step 12/17] in directory: C:\TeamCity\buildAgent\work\394b341d423ece2d
[09:44:48][Step 12/17]
[09:44:48][Step 12/17] Unhandled Exception: System.Data.SqlClient.SqlException: CREATE DATABASE permission denied in database 'master'.
[09:44:48][Step 12/17] at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
[09:44:48][Step 12/17] at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
[09:44:48][Step 12/17] at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
[09:44:48][Step 12/17] at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout)
[09:44:48][Step 12/17] at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
[09:44:48][Step 12/17] at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
[09:44:48][Step 12/17] at ##.#PCSc(SqlConnection #Gjoc, #WrPb )
[09:44:48][Step 12/17] at #WMRc.#WrPb.#8vSc()
[09:44:48][Step 12/17] at #JMRc.#NNd.#yMSc(#IMRc #gnSc, #LQRc #AfSc, #TMRc #vhSc, #lO3 #qBSc, #MHTc #RHTc, #MHTc #SuUc)
[09:44:48][Step 12/17] at ##.#2MRc(String[] #ead)
[09:44:53][Step 12/17] Process exited with code 255
[09:44:53][Step 12/17] Step Build database from source control (Red Gate (SQL Server)) failed

What is going on here? If I don't create the database, the plugin complains about it not being found. The configuration is so very simple I really don't see a way I could be misunderstanding it.

Any help would be appreciated!

/Nicklas
Back to top
View user's profile Send private message
dmweyek



Joined: 16 May 2012
Posts: 13

PostPosted: Wed Oct 17, 2012 7:12 pm    Post subject: Reply with quote

I'm also dealing with an issue with the TeamCity plugin. I don't want the plugin to drop the database. There doesn't seem to be an option for this in the plugin.

In my case, the plugin drops the DB has some strange sync failure and leaves the DB empty.

Another interesting note. The sync fails but the build is reported as successful.

Code:

[10:43:03][Generating creation script] Error: Synchronization of 'Scripts.state' and 'xxxx.xInventory' failed:
Back to top
View user's profile Send private message
dmweyek



Joined: 16 May 2012
Posts: 13

PostPosted: Thu Oct 25, 2012 10:16 pm    Post subject: Reply with quote

After looking at some of the artifacts posted by the build tools I Can see in the Deploy.ps1 power shell file that there is switch for mode.

createnew
upgrade
and else.

Does anyone know what I can change to affect these options. In my case, I want to do upgrades and not createnew. Is this not the right forum for these issues?
Back to top
View user's profile Send private message
hnorton



Joined: 27 Oct 2012
Posts: 1

PostPosted: Sat Oct 27, 2012 6:20 am    Post subject: Reply with quote

I am also seeing the same issue using TeamCity 7.1 and the latest Red Gate plugin. Again, it looks like the cause is something missing in the deploy.ps1 file. It looks like it depends on the $mode variable being set to either "createnew" or "update". But nowhere in the plugin do I see the ability to set that.
Back to top
View user's profile Send private message
David Atkinson



Joined: 05 Dec 2005
Posts: 1120
Location: Twitter: @dtabase

PostPosted: Sat Oct 27, 2012 10:15 am    Post subject: Reply with quote

The TeamCity plugin currently drops and recreates a database in order to run tests, and generate and validate creation and upgrade scripts. It needs to rebuild the database to verify that the creation script works and to create a clean state for the unit tests.

The next version of the plugin will also provide an option to specify a database that is simply kept up to date incrementally with the latest changes. If you could hold out for the next plugin then I think it will work for you.

Another option is to not use the plugin for this scenario and call in a separate command line build step:

sqlcompare.exe /scripts1:<yourscriptsfolder> /s2:<yourserver> /db2:<yourdatbase> /sync
Back to top
View user's profile Send private message Send e-mail
dmweyek



Joined: 16 May 2012
Posts: 13

PostPosted: Thu Nov 08, 2012 1:59 am    Post subject: Reply with quote

David,

Is this the proper forum for the Team City plugin. I have some other errors I'm seeing but I'm not sure where to post them.

Thanks,

Doug
Back to top
View user's profile Send private message
David Atkinson



Joined: 05 Dec 2005
Posts: 1120
Location: Twitter: @dtabase

PostPosted: Thu Nov 08, 2012 2:04 am    Post subject: Reply with quote

Please create a new topic in this forum please. We'll eventually create a dedicated forum for CI and automated build processes.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group