I recently delivered a compiled nuget package from our build server (TFS 2015 with VSTS style build) to our QA department to update their test environment. Per my
previous discussion on this board, I directed them to start with an empty target database. They went though the following steps to deploy:
- $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
After running through the steps, the analyst came back and informed me the database was still empty. No schemas, tables, procs, functions or views had been deployed.
Working together, we modified our approach to check what was attempting to deploy:
- $production = New-DatabaseConnection -serverinstance SERVERINSTANCE -Database DATABASENAME
- Test-DatabaseConnection $production
- $file = 'PACKAGETITLE.nupkg'
- $build = Import-DatabaseBuildArtifact $file
- $release = New-DatabaseReleaseArtifact -Source $build -Target $production
- Export-DatabaseReleaseArtifact -InputObject $release -Path C:\temp\FOLDER -Force -Verbose
The result was that SCA thought there were no changes to deploy, despite the fact the database was empty.
I then compiled the project locally and generated the DATABASENAME-Package.sql file as well as the ps1 file. We ran that script and the database was fully populated with tables, views, etc. I repeated the steps above to export the database release artifact. The update script created wanted to
drop all tables, views, stored procedures, etc from my database.
It wanted to empty it out.
What's going on?????
Working together, we modified our approach to check what was attempting to deploy:
I then compiled the project locally and generated the DATABASENAME-Package.sql file as well as the ps1 file. We ran that script and the database was fully populated with tables, views, etc. I repeated the steps above to export the database release artifact. The update script created wanted to drop all tables, views, stored procedures, etc from my database. It wanted to empty it out.
What's going on?????