mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-20 01:25:41 -05:00
Open dacfx deploy script instead of saving to file path (#822)
* open dacfx deploy script * moving test db cleanups into finally blocks
This commit is contained in:
@@ -49,12 +49,6 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare
|
||||
}
|
||||
|
||||
public void Execute(TaskExecutionMode mode)
|
||||
{
|
||||
Execute();
|
||||
AddScriptToTask();
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
if (this.CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
@@ -64,6 +58,17 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare
|
||||
try
|
||||
{
|
||||
this.ScriptGenerationResult = this.ComparisonResult.GenerateScript(this.Parameters.TargetDatabaseName);
|
||||
|
||||
// tests don't create a SqlTask, so only add the script when the SqlTask isn't null
|
||||
if (this.SqlTask != null)
|
||||
{
|
||||
this.SqlTask.AddScript(SqlTaskStatus.Succeeded, this.ScriptGenerationResult.Script);
|
||||
if (!string.IsNullOrEmpty(this.ScriptGenerationResult.MasterScript))
|
||||
{
|
||||
// master script is only used if the target is Azure SQL db and the script contains all operations that must be done against the master database
|
||||
this.SqlTask.AddScript(SqlTaskStatus.Succeeded, ScriptGenerationResult.MasterScript);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -73,17 +78,6 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare
|
||||
}
|
||||
}
|
||||
|
||||
// Separated from Execute() since tests don't create SqlTasks
|
||||
public void AddScriptToTask()
|
||||
{
|
||||
this.SqlTask.AddScript(SqlTaskStatus.Succeeded, this.ScriptGenerationResult.Script);
|
||||
if (!string.IsNullOrEmpty(this.ScriptGenerationResult.MasterScript))
|
||||
{
|
||||
// master script is only used if the target is Azure SQL db and the script contains all operations that must be done against the master database
|
||||
this.SqlTask.AddScript(SqlTaskStatus.Succeeded, ScriptGenerationResult.MasterScript);
|
||||
}
|
||||
}
|
||||
|
||||
// The schema compare public api doesn't currently take a cancellation token so the operation can't be cancelled
|
||||
public void Cancel()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user