mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Feature/schemacompare Exclude-Include and Options enhancement (#799)
* Initial code for Including/Excluding individual changes (no tests added yet) * Adding Exclude include tests. Default options call and additional options tests. * Taking PR comments * Retry in test for reliability
This commit is contained in:
@@ -41,7 +41,7 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts
|
||||
public bool IgnoreLockHintsOnIndexes { get; set; }
|
||||
|
||||
public bool IgnoreKeywordCasing { get; set; }
|
||||
|
||||
|
||||
public bool IgnoreIndexPadding { get; set; }
|
||||
|
||||
public bool IgnoreIndexOptions { get; set; }
|
||||
@@ -51,21 +51,21 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts
|
||||
public bool IgnoreIdentitySeed { get; set; }
|
||||
|
||||
public bool IgnoreUserSettingsObjects { get; set; }
|
||||
|
||||
|
||||
public bool IgnoreFullTextCatalogFilePath { get; set; }
|
||||
|
||||
|
||||
public bool IgnoreWhitespace { get; set; }
|
||||
|
||||
public bool IgnoreWithNocheckOnForeignKeys { get; set; }
|
||||
|
||||
|
||||
public bool VerifyCollationCompatibility { get; set; }
|
||||
|
||||
|
||||
public bool UnmodifiableObjectWarnings { get; set; }
|
||||
|
||||
public bool TreatVerificationErrorsAsWarnings { get; set; }
|
||||
|
||||
|
||||
public bool ScriptRefreshModule { get; set; }
|
||||
|
||||
|
||||
public bool ScriptNewConstraintValidation { get; set; }
|
||||
|
||||
public bool ScriptFileSize { get; set; }
|
||||
@@ -81,7 +81,7 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts
|
||||
public bool RunDeploymentPlanExecutors { get; set; }
|
||||
|
||||
public bool RegisterDataTierApplication { get; set; }
|
||||
|
||||
|
||||
public bool PopulateFilesOnFileGroups { get; set; }
|
||||
|
||||
public bool NoAlterStatementsToChangeClrTypes { get; set; }
|
||||
@@ -93,17 +93,17 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts
|
||||
public bool AllowUnsafeRowLevelSecurityDataMovement { get; set; }
|
||||
|
||||
public bool IgnoreWithNocheckOnCheckConstraints { get; set; }
|
||||
|
||||
|
||||
public bool IgnoreFillFactor { get; set; }
|
||||
|
||||
|
||||
public bool IgnoreFileSize { get; set; }
|
||||
|
||||
|
||||
public bool IgnoreFilegroupPlacement { get; set; }
|
||||
|
||||
|
||||
public bool DoNotAlterReplicatedObjects { get; set; }
|
||||
|
||||
|
||||
public bool DoNotAlterChangeDataCaptureObjects { get; set; }
|
||||
|
||||
|
||||
public bool DisableAndReenableDdlTriggers { get; set; }
|
||||
|
||||
public bool DeployDatabaseInSingleUserMode { get; set; }
|
||||
@@ -113,11 +113,11 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts
|
||||
public bool CompareUsingTargetCollation { get; set; }
|
||||
|
||||
public bool CommentOutSetVarDeclarations { get; set; }
|
||||
|
||||
|
||||
public int CommandTimeout { get; set; } = 120;
|
||||
|
||||
public bool BlockWhenDriftDetected { get; set; }
|
||||
|
||||
|
||||
public bool BlockOnPossibleDataLoss { get; set; }
|
||||
|
||||
public bool BackupDatabaseBeforeChanges { get; set; }
|
||||
@@ -129,15 +129,15 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts
|
||||
public string AdditionalDeploymentContributorArguments { get; set; }
|
||||
|
||||
public string AdditionalDeploymentContributors { get; set; }
|
||||
|
||||
|
||||
public bool DropConstraintsNotInSource { get; set; }
|
||||
|
||||
|
||||
public bool DropDmlTriggersNotInSource { get; set; }
|
||||
|
||||
|
||||
public bool DropExtendedPropertiesNotInSource { get; set; }
|
||||
|
||||
|
||||
public bool DropIndexesNotInSource { get; set; }
|
||||
|
||||
|
||||
public bool IgnoreFileAndLogFilePath { get; set; }
|
||||
|
||||
public bool IgnoreExtendedProperties { get; set; }
|
||||
@@ -151,9 +151,9 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts
|
||||
public bool IgnoreDdlTriggerState { get; set; }
|
||||
|
||||
public bool IgnoreDdlTriggerOrder { get; set; }
|
||||
|
||||
|
||||
public bool IgnoreCryptographicProviderFilePath { get; set; }
|
||||
|
||||
|
||||
public bool VerifyDeployment { get; set; }
|
||||
|
||||
public bool IgnoreComments { get; set; }
|
||||
@@ -161,17 +161,17 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts
|
||||
public bool IgnoreColumnCollation { get; set; }
|
||||
|
||||
public bool IgnoreAuthorizer { get; set; }
|
||||
|
||||
|
||||
public bool IgnoreAnsiNulls { get; set; }
|
||||
|
||||
public bool GenerateSmartDefaults { get; set; }
|
||||
|
||||
|
||||
public bool DropStatisticsNotInSource { get; set; }
|
||||
|
||||
public bool DropRoleMembersNotInSource { get; set; }
|
||||
|
||||
public bool DropPermissionsNotInSource { get; set; }
|
||||
|
||||
|
||||
public bool DropObjectsNotInSource { get; set; }
|
||||
|
||||
public bool IgnoreColumnOrder { get; set; }
|
||||
@@ -208,11 +208,13 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts
|
||||
{
|
||||
DacDeployOptions options = new DacDeployOptions();
|
||||
System.Reflection.PropertyInfo[] deploymentOptionsProperties = this.GetType().GetProperties();
|
||||
|
||||
|
||||
foreach (var deployOptionsProp in deploymentOptionsProperties)
|
||||
{
|
||||
var prop = options.GetType().GetProperty(deployOptionsProp.Name);
|
||||
if (prop != null)
|
||||
|
||||
// Note that we set excluded object types here since dacfx has this value as null;
|
||||
if (prop != null && deployOptionsProp.Name != "ExcludeObjectTypes")
|
||||
{
|
||||
deployOptionsProp.SetValue(this, prop.GetValue(options));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.TaskServices;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters for a schema compare include specific node request
|
||||
/// </summary>
|
||||
public class SchemaCompareNodeParams
|
||||
{
|
||||
/// <summary>
|
||||
/// Operation id of the schema compare operation
|
||||
/// </summary>
|
||||
public string OperationId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Difference to Include or exclude
|
||||
/// </summary>
|
||||
public DiffEntry DiffEntry { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicator for include or exclude request
|
||||
/// </summary>
|
||||
public bool IncludeRequest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Execution mode for the operation. Default is execution
|
||||
/// </summary>
|
||||
public TaskExecutionMode TaskExecutionMode { get; set; }
|
||||
}
|
||||
|
||||
class SchemaCompareIncludeExcludeNodeRequest
|
||||
{
|
||||
public static readonly RequestType<SchemaCompareNodeParams, ResultStatus> Type =
|
||||
RequestType<SchemaCompareNodeParams, ResultStatus>.Create("schemaCompare/includeExcludeNode");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines paramaters for Get default options call
|
||||
/// No parameters required so far
|
||||
/// </summary>
|
||||
public class SchemaCompareGetOptionsParams
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the result of get default options call
|
||||
/// </summary>
|
||||
public class SchemaCompareOptionsResult : ResultStatus
|
||||
{
|
||||
public DeploymentOptions DefaultDeploymentOptions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the Schema Compare request type
|
||||
/// </summary>
|
||||
class SchemaCompareGetDefaultOptionsRequest
|
||||
{
|
||||
public static readonly RequestType<SchemaCompareGetOptionsParams, SchemaCompareOptionsResult> Type =
|
||||
RequestType<SchemaCompareGetOptionsParams, SchemaCompareOptionsResult>.Create("schemaCompare/getDefaultOptions");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -79,15 +79,15 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts
|
||||
|
||||
public class DiffEntry
|
||||
{
|
||||
public SchemaUpdateAction UpdateAction;
|
||||
public SchemaDifferenceType DifferenceType;
|
||||
public string Name;
|
||||
public string SourceValue;
|
||||
public string TargetValue;
|
||||
public DiffEntry Parent;
|
||||
public List<DiffEntry> Children;
|
||||
public string SourceScript;
|
||||
public string TargetScript;
|
||||
public SchemaUpdateAction UpdateAction { get; set; }
|
||||
public SchemaDifferenceType DifferenceType { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string SourceValue { get; set; }
|
||||
public string TargetValue { get; set; }
|
||||
public DiffEntry Parent { get; set; }
|
||||
public List<DiffEntry> Children { get; set; }
|
||||
public string SourceScript { get; set; }
|
||||
public string TargetScript { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user