Send deploymentOptions to DacFx to save in the publish profile xml file (#1997)

* Send deploymentOptions to DacFx to save in the publish profile xml file

* Update Packages.prop with latest DacFx nuget version.

* Update Dacfx version after merge from main.

* Address comments

* Update method name
This commit is contained in:
Sakshi Sharma
2023-04-10 17:31:39 -07:00
committed by GitHub
parent 7bf370a4a5
commit 9aa84f517c
10 changed files with 122 additions and 85 deletions

View File

@@ -882,6 +882,17 @@ Streaming query statement contains a reference to missing output stream 'Missing
string profileFilePath = Path.Combine(folderPath, fileName);
string expectedFile = Path.Combine(publishProfileFolder, fileName);
DeploymentOptions deploymentOptions = DeploymentOptions.GetDefaultPublishOptions();
// a few extra options get added in the publish.xml file, because of the defaults that are set in STS for maintaining compatibility with ADS and SSDT
// these defaults are defined in ..\sqltoolsservice\src\Microsoft.SqlTools.ServiceLayer\DacFx\Contracts\DeploymentOptions.cs
deploymentOptions.ExcludeObjectTypes = new DeploymentOptionProperty<string[]>(new[] { nameof(ObjectType.Views) });
deploymentOptions.BooleanOptionsDictionary[nameof(DacDeployOptions.CreateNewDatabase)].Value = true;
deploymentOptions.BooleanOptionsDictionary[nameof(DacDeployOptions.DropConstraintsNotInSource)].Value = false;
deploymentOptions.BooleanOptionsDictionary[nameof(DacDeployOptions.ScriptFileSize)].Value = true;
deploymentOptions.BooleanOptionsDictionary[nameof(DacDeployOptions.VerifyDeployment)].Value = false;
deploymentOptions.BooleanOptionsDictionary[nameof(DacDeployOptions.AllowIncompatiblePlatform)].Value = true;
var savePublishProfileParams = new SavePublishProfileParams
{
ProfilePath = profileFilePath,
@@ -890,7 +901,8 @@ Streaming query statement contains a reference to missing output stream 'Missing
SqlCommandVariableValues = new Dictionary<string, string>()
{
{ "testvar", "testval" }
}
},
DeploymentOptions = deploymentOptions
};
MockRequest<ResultStatus> requestMock = new();

View File

@@ -3,6 +3,18 @@
<PropertyGroup>
<TargetDatabaseName>testDb</TargetDatabaseName>
<TargetConnectionString>testConnString</TargetConnectionString>
<AllowIncompatiblePlatform>True</AllowIncompatiblePlatform>
<CreateNewDatabase>True</CreateNewDatabase>
<DropConstraintsNotInSource>False</DropConstraintsNotInSource>
<DropPermissionsNotInSource>True</DropPermissionsNotInSource>
<DropObjectsNotInSource>True</DropObjectsNotInSource>
<DropRoleMembersNotInSource>True</DropRoleMembersNotInSource>
<IgnoreKeywordCasing>False</IgnoreKeywordCasing>
<IgnoreSemicolonBetweenStatements>False</IgnoreSemicolonBetweenStatements>
<ScriptFileSize>True</ScriptFileSize>
<VerifyDeployment>False</VerifyDeployment>
<AllowDropBlockingAssemblies>True</AllowDropBlockingAssemblies>
<ExcludeViews>True</ExcludeViews>
<ProfileVersionNumber>1</ProfileVersionNumber>
</PropertyGroup>
<ItemGroup>