mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-25 17:24:17 -05:00
Update DacFx deploy and generate script with options (#998)
* update deploy and generate script to accept deployment options * add tests * add test with option set to true
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
//
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.DacFx.Contracts
|
||||
{
|
||||
@@ -21,6 +22,11 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx.Contracts
|
||||
/// Gets or sets SQLCMD variables for deployment
|
||||
/// </summary>
|
||||
public IDictionary<string, string> SqlCommandVariableValues { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the options for deployment
|
||||
/// </summary>
|
||||
public DeploymentOptions DeploymentOptions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
//
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.DacFx.Contracts
|
||||
{
|
||||
@@ -26,6 +27,11 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx.Contracts
|
||||
/// Gets or sets SQLCMD variables for script generation
|
||||
/// </summary>
|
||||
public IDictionary<string, string> SqlCommandVariableValues { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the options for deployment
|
||||
/// </summary>
|
||||
public DeploymentOptions DeploymentOptions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
using Microsoft.SqlServer.Dac;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||
using Microsoft.SqlTools.ServiceLayer.DacFx.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.SchemaCompare;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.DacFx
|
||||
@@ -25,7 +26,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
|
||||
public override void Execute()
|
||||
{
|
||||
DacPackage dacpac = DacPackage.Load(this.Parameters.PackageFilePath);
|
||||
DacDeployOptions options = this.GetDefaultDeployOptions();
|
||||
DacDeployOptions options = this.Parameters.DeploymentOptions != null ? SchemaCompareUtils.CreateSchemaCompareOptions(this.Parameters.DeploymentOptions) : this.GetDefaultDeployOptions();
|
||||
|
||||
if (this.Parameters.SqlCommandVariableValues != null)
|
||||
{
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
using Microsoft.SqlServer.Dac;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||
using Microsoft.SqlTools.ServiceLayer.DacFx.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.TaskServices;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
using System;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Microsoft.SqlServer.Dac;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||
using Microsoft.SqlTools.ServiceLayer.DacFx.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.SchemaCompare;
|
||||
using Microsoft.SqlTools.ServiceLayer.TaskServices;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.DacFx
|
||||
{
|
||||
@@ -35,7 +36,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
|
||||
PublishOptions publishOptions = new PublishOptions();
|
||||
publishOptions.GenerateDeploymentReport = this.Parameters.GenerateDeploymentReport;
|
||||
publishOptions.CancelToken = this.CancellationToken;
|
||||
publishOptions.DeployOptions = this.GetDefaultDeployOptions();
|
||||
publishOptions.DeployOptions = this.Parameters.DeploymentOptions != null ? SchemaCompareUtils.CreateSchemaCompareOptions(this.Parameters.DeploymentOptions) : this.GetDefaultDeployOptions();
|
||||
|
||||
if (this.Parameters.SqlCommandVariableValues != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user