How do you actually deploy a new database from the nuget package
l570
Posts: 16 Bronze 1
I'm trying to recreate a problem in production. I've dropped my own version of the database and trying to deploy the item from our built nuget package. But since I don't have the database anymore, the connection object fails. So how do you actually deploy a new database from the nuget package.
My steps are as follows:
My steps are as follows:
- $production = New-DatabaseConnection -ServerInstance "SERVERINSTANCE" -Database "DATABASENAME"
- $package ='PACKAGETITLE.nupkg'
- $build = Import-DatabaseBuildArtifact $package
- $release = New-DatabaseReleaseArtifact -Source $build -Target $production
- Use-DatabaseReleaseArtifact $release -DeployTo $production
New-DatabaseReleaseArtifact : Couldn't connect to the database specified by the Target
parameter: Cannot open database "DATABASENAME" requested by the login. The login failed.
Login failed for user 'ME'.
Local parameters [connectionString = Data Source=SERVERINSTANCE;Initial
Catalog=DATABASENAME;Integrated Security=True;Pooling=False;Application Name="Redgate
Software - SQL Change Automation"]
Am I missing a flag or something?
Am I missing a flag or something?
Tagged:
Answers
Your script appears to be ok, as hinted already by PeterDaniels, I would suggest testing the same connection settings in SSMS on that system
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools
So what am I doing wrong?
You can do it manually or use the Pre-Deployment script for that
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools
The problem is that the release does not even get to the Pre-Deployment script because it is trying to validate a connection to the database being released. Since the database does not exist, the connection fails. This all happens prior to the Pre-Deployment script.
The connection string specifies the target database, which does not exist. Obviously there must be a way to make this work since you have the concept of a Pre-Deployment script that creates the database.
Any help is much appreciated.
Sam
I have just tested this with a SCA project and it is working, you should only get a warning:
I have created a support ticket and will contact you there to get more details regarding your particular issue.
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools
Please note that if you are using Azure Devops you will use the latest version of the add-on by default, but if you are on-premises TFS you need to update it manually from the marketplace.
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools