Using the TeamCity integration, the "Redgate SQL Change Automation Build" build step, I'm trying to generate a NuGet package for deployment to multiple servers.
In the build step I have specified the server and temporary database name.
I have granted the TeamCity agent all rights (db_owner) on that database.
The build fails with the following in the log:
VERBOSE: SQLCompare.exe completed successfully.
VERBOSE: Altering schemas
VERBOSE: Dropping users
WARNING: The error 'The server principal "**server\username**" is not able to access the database "**dbName**"
under the current security context.' occurred when executing the following SQL:
@ERROR <> 0 SET NOEXEC ON
After this I added the user again and revoked the rights to change users and roles. Then the log went like this:
VERBOSE: SQLCompare.exe completed successfully.
VERBOSE: Altering schemas
VERBOSE: Dropping users
WARNING: The error 'Cannot drop the user '**server\username**', because it does not exist or you do not have permission.' occurred when executing the following SQL:
DROP USER [**server\username**]
VERBOSE: The database update failed
Invoke-DatabaseBuild : Failed to clean the database '**dbName**' on server '**servername**'.
Is there any therapy I can apply to help this suicidal user?
VERBOSE: Altering schemas
VERBOSE: Dropping users
WARNING: The error 'The server principal "**server\username**" is not able to access the database "**dbName**"
under the current security context.' occurred when executing the following SQL:
@ERROR <> 0 SET NOEXEC ON
VERBOSE: Altering schemas
VERBOSE: Dropping users
WARNING: The error 'Cannot drop the user '**server\username**', because it does not exist or you do not have permission.' occurred when executing the following SQL:
DROP USER [**server\username**]
VERBOSE: The database update failed
Invoke-DatabaseBuild : Failed to clean the database '**dbName**' on server '**servername**'.