// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // using System.Collections.Generic; using Microsoft.SqlServer.Dac.Compare; using Microsoft.SqlTools.Hosting.Protocol.Contracts; using Microsoft.SqlTools.ServiceLayer.Connection.Contracts; using Microsoft.SqlTools.ServiceLayer.DacFx.Contracts; using Microsoft.SqlTools.ServiceLayer.TaskServices; using Microsoft.SqlTools.ServiceLayer.Utility; namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts { /// /// Types of schema compare endpoints /// public enum SchemaCompareEndpointType { Database = 0, Dacpac = 1, Project = 2 // must be kept in-sync with SchemaCompareEndpointType in Azure Data Studio // located at \extensions\mssql\src\mssql.d.ts } /// /// Info needed from endpoints for schema comparison /// public class SchemaCompareEndpointInfo { /// /// Gets or sets the type of the endpoint /// public SchemaCompareEndpointType EndpointType { get; set; } /// /// Gets or sets the project file path /// public string ProjectFilePath { get; set; } /// /// Gets or sets the scripts included in project /// public string[] TargetScripts { get; set; } /// /// Gets or sets the project data schema provider /// public string DataSchemaProvider { get; set; } /// /// Gets or sets package filepath /// public string PackageFilePath { get; set; } /// /// Gets or sets name for the database /// public string DatabaseName { get; set; } /// /// Connection uri /// public string OwnerUri { get; set; } /// /// Connection details /// public ConnectionDetails ConnectionDetails { get; set; } } /// /// Parameters for a schema compare request. /// public class SchemaCompareParams { /// /// Operation id of the schema compare operation /// public string OperationId { get; set; } /// /// Gets or sets the source endpoint info /// public SchemaCompareEndpointInfo SourceEndpointInfo { get; set; } /// /// Gets or sets the target endpoint info /// public SchemaCompareEndpointInfo TargetEndpointInfo { get; set; } /// /// Executation mode for the operation. Default is execution /// public TaskExecutionMode TaskExecutionMode { get; set; } /// /// gets or sets the deployment options for schema compare /// public DeploymentOptions DeploymentOptions { get; set; } } /// /// Parameters returned from a schema compare request. /// public class SchemaCompareResult : ResultStatus { public string OperationId { get; set; } public bool AreEqual { get; set; } public List Differences { get; set; } } public class DiffEntry { 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 Children { get; set; } public string SourceScript { get; set; } public string TargetScript { get; set; } public string SourceObjectType { get; set; } public string TargetObjectType { get; set; } public bool Included { get; set; } } /// /// Defines the Schema Compare request type /// class SchemaCompareRequest { public static readonly RequestType Type = RequestType.Create("schemaCompare/compare"); } }