mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Include Object Types logic refactored and options fetching from DacFx (#20031)
* Include Object Types logic refactored and options fetching from DacFx * Removed localized object types constants * Prop name updated and references and tests updated * updated comments * STS vBump * updating the test file to pass the PR Validations
This commit is contained in:
committed by
GitHub
parent
2b5d2f0a0b
commit
54d4098f85
@@ -302,7 +302,7 @@ suite('Schema compare integration test suite @DacFx@', () => {
|
|||||||
assert(includeResult.affectedDependencies[0].included === true, 'Table t2 should be included as a result of including v1. Actual: false');
|
assert(includeResult.affectedDependencies[0].included === true, 'Table t2 should be included as a result of including v1. Actual: false');
|
||||||
|
|
||||||
// excluding views from the comparison should make it so t2 can be excluded
|
// excluding views from the comparison should make it so t2 can be excluded
|
||||||
deploymentOptions.excludeObjectTypes.value.push(mssql.SchemaObjectType.Views);
|
deploymentOptions.excludeObjectTypes.value.push(Object.keys(deploymentOptions.objectTypesDictionary).find((key) => { return deploymentOptions.objectTypesDictionary[key] === 'Views'; }));
|
||||||
await schemaCompareService.schemaCompare(operationId, source, target, azdata.TaskExecutionMode.execute, deploymentOptions);
|
await schemaCompareService.schemaCompare(operationId, source, target, azdata.TaskExecutionMode.execute, deploymentOptions);
|
||||||
const excludeResult3 = await schemaCompareService.schemaCompareIncludeExcludeNode(operationId, t2Difference, false, azdata.TaskExecutionMode.execute);
|
const excludeResult3 = await schemaCompareService.schemaCompareIncludeExcludeNode(operationId, t2Difference, false, azdata.TaskExecutionMode.execute);
|
||||||
assertIncludeExcludeResult(excludeResult3, true, 0, 0);
|
assertIncludeExcludeResult(excludeResult3, true, 0, 0);
|
||||||
@@ -507,7 +507,7 @@ suite('Schema compare integration test suite @DacFx@', () => {
|
|||||||
|
|
||||||
const deploymentOptionsResult = await schemaCompareService.schemaCompareGetDefaultOptions();
|
const deploymentOptionsResult = await schemaCompareService.schemaCompareGetDefaultOptions();
|
||||||
let deploymentOptions = deploymentOptionsResult.defaultDeploymentOptions;
|
let deploymentOptions = deploymentOptionsResult.defaultDeploymentOptions;
|
||||||
deploymentOptions.excludeObjectTypes.value.push(mssql.SchemaObjectType.TableValuedFunctions);
|
deploymentOptions.excludeObjectTypes.value.push(Object.keys(deploymentOptions.objectTypesDictionary).find((key) => { return deploymentOptions.objectTypesDictionary[key] === 'TableValuedFunctions'; }));
|
||||||
const schemaCompareResult = await schemaCompareService.schemaCompare(operationId, source, target, azdata.TaskExecutionMode.execute, deploymentOptions);
|
const schemaCompareResult = await schemaCompareService.schemaCompare(operationId, source, target, azdata.TaskExecutionMode.execute, deploymentOptions);
|
||||||
assertSchemaCompareResult(schemaCompareResult, operationId, 3);
|
assertSchemaCompareResult(schemaCompareResult, operationId, 3);
|
||||||
|
|
||||||
|
|||||||
77
extensions/mssql/src/mssql.d.ts
vendored
77
extensions/mssql/src/mssql.d.ts
vendored
@@ -179,7 +179,7 @@ declare module 'mssql' {
|
|||||||
excludeObjectTypes: DacDeployOptionPropertyObject;
|
excludeObjectTypes: DacDeployOptionPropertyObject;
|
||||||
// key will be the boolean option name
|
// key will be the boolean option name
|
||||||
booleanOptionsDictionary: { [key: string]: DacDeployOptionPropertyBoolean };
|
booleanOptionsDictionary: { [key: string]: DacDeployOptionPropertyBoolean };
|
||||||
// key will be the object type enum name(nothing but option name)
|
// key will be the object type enum name (nothing but option name)
|
||||||
objectTypesDictionary: { [key: string]: string };
|
objectTypesDictionary: { [key: string]: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,81 +191,6 @@ declare module 'mssql' {
|
|||||||
checked: boolean;
|
checked: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Values from <DacFx>\Product\Source\DeploymentApi\ObjectTypes.cs
|
|
||||||
*/
|
|
||||||
export const enum SchemaObjectType {
|
|
||||||
Aggregates = 0,
|
|
||||||
ApplicationRoles = 1,
|
|
||||||
Assemblies = 2,
|
|
||||||
AssemblyFiles = 3,
|
|
||||||
AsymmetricKeys = 4,
|
|
||||||
BrokerPriorities = 5,
|
|
||||||
Certificates = 6,
|
|
||||||
ColumnEncryptionKeys = 7,
|
|
||||||
ColumnMasterKeys = 8,
|
|
||||||
Contracts = 9,
|
|
||||||
DatabaseOptions = 10,
|
|
||||||
DatabaseRoles = 11,
|
|
||||||
DatabaseTriggers = 12,
|
|
||||||
Defaults = 13,
|
|
||||||
ExtendedProperties = 14,
|
|
||||||
ExternalDataSources = 15,
|
|
||||||
ExternalFileFormats = 16,
|
|
||||||
ExternalTables = 17,
|
|
||||||
Filegroups = 18,
|
|
||||||
Files = 19,
|
|
||||||
FileTables = 20,
|
|
||||||
FullTextCatalogs = 21,
|
|
||||||
FullTextStoplists = 22,
|
|
||||||
MessageTypes = 23,
|
|
||||||
PartitionFunctions = 24,
|
|
||||||
PartitionSchemes = 25,
|
|
||||||
Permissions = 26,
|
|
||||||
Queues = 27,
|
|
||||||
RemoteServiceBindings = 28,
|
|
||||||
RoleMembership = 29,
|
|
||||||
Rules = 30,
|
|
||||||
ScalarValuedFunctions = 31,
|
|
||||||
SearchPropertyLists = 32,
|
|
||||||
SecurityPolicies = 33,
|
|
||||||
Sequences = 34,
|
|
||||||
Services = 35,
|
|
||||||
Signatures = 36,
|
|
||||||
StoredProcedures = 37,
|
|
||||||
SymmetricKeys = 38,
|
|
||||||
Synonyms = 39,
|
|
||||||
Tables = 40,
|
|
||||||
TableValuedFunctions = 41,
|
|
||||||
UserDefinedDataTypes = 42,
|
|
||||||
UserDefinedTableTypes = 43,
|
|
||||||
ClrUserDefinedTypes = 44,
|
|
||||||
Users = 45,
|
|
||||||
Views = 46,
|
|
||||||
XmlSchemaCollections = 47,
|
|
||||||
Audits = 48,
|
|
||||||
Credentials = 49,
|
|
||||||
CryptographicProviders = 50,
|
|
||||||
DatabaseAuditSpecifications = 51,
|
|
||||||
DatabaseEncryptionKeys = 52,
|
|
||||||
DatabaseScopedCredentials = 53,
|
|
||||||
Endpoints = 54,
|
|
||||||
ErrorMessages = 55,
|
|
||||||
EventNotifications = 56,
|
|
||||||
EventSessions = 57,
|
|
||||||
LinkedServerLogins = 58,
|
|
||||||
LinkedServers = 59,
|
|
||||||
Logins = 60,
|
|
||||||
MasterKeys = 61,
|
|
||||||
Routes = 62,
|
|
||||||
ServerAuditSpecifications = 63,
|
|
||||||
ServerRoleMembership = 64,
|
|
||||||
ServerRoles = 65,
|
|
||||||
ServerTriggers = 66,
|
|
||||||
ExternalStreams = 67,
|
|
||||||
ExternalStreamingJobs = 68
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SchemaCompareObjectId {
|
export interface SchemaCompareObjectId {
|
||||||
nameParts: string[];
|
nameParts: string[];
|
||||||
sqlObjectType: string;
|
sqlObjectType: string;
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export class SchemaCompareOptionsDialog {
|
|||||||
protected execute(): void {
|
protected execute(): void {
|
||||||
// Update the model deploymentoptions with the updated table component values
|
// Update the model deploymentoptions with the updated table component values
|
||||||
this.optionsModel.setDeploymentOptions();
|
this.optionsModel.setDeploymentOptions();
|
||||||
this.optionsModel.setObjectTypeOptions();
|
this.optionsModel.setIncludeObjectTypesToDeploymentOptions();
|
||||||
// Set the publish deploymentoptions with the updated table component values
|
// Set the publish deploymentoptions with the updated table component values
|
||||||
this.schemaComparison.setDeploymentOptions(this.optionsModel.deploymentOptions);
|
this.schemaComparison.setDeploymentOptions(this.optionsModel.deploymentOptions);
|
||||||
|
|
||||||
@@ -102,6 +102,7 @@ export class SchemaCompareOptionsDialog {
|
|||||||
|
|
||||||
// reset optionsvalueNameLookup with fresh deployment options
|
// reset optionsvalueNameLookup with fresh deployment options
|
||||||
this.optionsModel.setOptionsToValueNameLookup();
|
this.optionsModel.setOptionsToValueNameLookup();
|
||||||
|
this.optionsModel.setIncludeObjectTypesLookup();
|
||||||
|
|
||||||
await this.updateOptionsTable();
|
await this.updateOptionsTable();
|
||||||
this.optionsFlexBuilder.removeItem(this.optionsTable);
|
this.optionsFlexBuilder.removeItem(this.optionsTable);
|
||||||
@@ -182,11 +183,13 @@ export class SchemaCompareOptionsDialog {
|
|||||||
this.objectsTable = view.modelBuilder.table().component();
|
this.objectsTable = view.modelBuilder.table().component();
|
||||||
await this.updateObjectsTable();
|
await this.updateObjectsTable();
|
||||||
|
|
||||||
|
// Update inlcude object type options value on checkbox onchange
|
||||||
this.disposableListeners.push(this.objectsTable.onCellAction((rowState) => {
|
this.disposableListeners.push(this.objectsTable.onCellAction((rowState) => {
|
||||||
let checkboxState = <azdata.ICheckboxCellActionEventArgs>rowState;
|
let checkboxState = <azdata.ICheckboxCellActionEventArgs>rowState;
|
||||||
if (checkboxState && checkboxState.row !== undefined) {
|
if (checkboxState && checkboxState.row !== undefined) {
|
||||||
let label = this.optionsModel.objectTypeLabels[checkboxState.row];
|
// data[row][1] contains the include object type option display name
|
||||||
this.optionsModel.objectsLookup[label] = checkboxState.checked;
|
const displayName = this.objectsTable?.data[checkboxState.row][1];
|
||||||
|
this.optionsModel.setIncludeObjectTypesOptionValue(displayName, checkboxState.checked);
|
||||||
this.optionsChanged = true;
|
this.optionsChanged = true;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
@@ -229,7 +232,7 @@ export class SchemaCompareOptionsDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async updateObjectsTable(): Promise<void> {
|
private async updateObjectsTable(): Promise<void> {
|
||||||
let data = this.optionsModel.getObjectsData();
|
let data = this.optionsModel.getIncludeObjectTypesOptionsData();
|
||||||
await this.objectsTable.updateProperties({
|
await this.objectsTable.updateProperties({
|
||||||
data: data,
|
data: data,
|
||||||
columns: [
|
columns: [
|
||||||
|
|||||||
@@ -91,77 +91,6 @@ export const save: string = localize('schemaCompare.saveFile', "Save");
|
|||||||
export function getConnectionString(caller: string): string { return localize('schemaCompare.GetConnectionString', "Do you want to connect to {0}?", caller); }
|
export function getConnectionString(caller: string): string { return localize('schemaCompare.GetConnectionString', "Do you want to connect to {0}?", caller); }
|
||||||
export const selectConnection: string = localize('schemaCompare.selectConnection', "Select connection");
|
export const selectConnection: string = localize('schemaCompare.selectConnection', "Select connection");
|
||||||
|
|
||||||
// object types
|
|
||||||
export const Aggregates: string = localize('SchemaCompare.Aggregates', "Aggregates");
|
|
||||||
export const ApplicationRoles: string = localize('SchemaCompare.ApplicationRoles', "Application Roles");
|
|
||||||
export const Assemblies: string = localize('SchemaCompare.Assemblies', "Assemblies");
|
|
||||||
export const AssemblyFiles: string = localize('SchemaCompare.AssemblyFiles', "Assembly Files");
|
|
||||||
export const AsymmetricKeys: string = localize('SchemaCompare.AsymmetricKeys', "Asymmetric Keys");
|
|
||||||
export const BrokerPriorities: string = localize('SchemaCompare.BrokerPriorities', "Broker Priorities");
|
|
||||||
export const Certificates: string = localize('SchemaCompare.Certificates', "Certificates");
|
|
||||||
export const ColumnEncryptionKeys: string = localize('SchemaCompare.ColumnEncryptionKeys', "Column Encryption Keys");
|
|
||||||
export const ColumnMasterKeys: string = localize('SchemaCompare.ColumnMasterKeys', "Column Master Keys");
|
|
||||||
export const Contracts: string = localize('SchemaCompare.Contracts', "Contracts");
|
|
||||||
export const DatabaseOptions: string = localize('SchemaCompare.DatabaseOptions', "Database Options");
|
|
||||||
export const DatabaseRoles: string = localize('SchemaCompare.DatabaseRoles', "Database Roles");
|
|
||||||
export const DatabaseTriggers: string = localize('SchemaCompare.DatabaseTriggers', "Database Triggers");
|
|
||||||
export const Defaults: string = localize('SchemaCompare.Defaults', "Defaults");
|
|
||||||
export const ExtendedProperties: string = localize('SchemaCompare.ExtendedProperties', "Extended Properties");
|
|
||||||
export const ExternalDataSources: string = localize('SchemaCompare.ExternalDataSources', "External Data Sources");
|
|
||||||
export const ExternalFileFormats: string = localize('SchemaCompare.ExternalFileFormats', "External File Formats");
|
|
||||||
export const ExternalStreams: string = localize('SchemaCompare.ExternalStreams', "External Streams");
|
|
||||||
export const ExternalStreamingJobs: string = localize('SchemaCompare.ExternalStreamingJobs', "External Streaming Jobs");
|
|
||||||
export const ExternalTables: string = localize('SchemaCompare.ExternalTables', "External Tables");
|
|
||||||
export const Filegroups: string = localize('SchemaCompare.Filegroups', "Filegroups");
|
|
||||||
export const Files: string = localize('SchemaCompare.Files', "Files");
|
|
||||||
export const FileTables: string = localize('SchemaCompare.FileTables', "File Tables");
|
|
||||||
export const FullTextCatalogs: string = localize('SchemaCompare.FullTextCatalogs', "Full Text Catalogs");
|
|
||||||
export const FullTextStoplists: string = localize('SchemaCompare.FullTextStoplists', "Full Text Stoplists");
|
|
||||||
export const MessageTypes: string = localize('SchemaCompare.MessageTypes', "Message Types");
|
|
||||||
export const PartitionFunctions: string = localize('SchemaCompare.PartitionFunctions', "Partition Functions");
|
|
||||||
export const PartitionSchemes: string = localize('SchemaCompare.PartitionSchemes', "Partition Schemes");
|
|
||||||
export const Permissions: string = localize('SchemaCompare.Permissions', "Permissions");
|
|
||||||
export const Queues: string = localize('SchemaCompare.Queues', "Queues");
|
|
||||||
export const RemoteServiceBindings: string = localize('SchemaCompare.RemoteServiceBindings', "Remote Service Bindings");
|
|
||||||
export const RoleMembership: string = localize('SchemaCompare.RoleMembership', "Role Membership");
|
|
||||||
export const Rules: string = localize('SchemaCompare.Rules', "Rules");
|
|
||||||
export const ScalarValuedFunctions: string = localize('SchemaCompare.ScalarValuedFunctions', "Scalar Valued Functions");
|
|
||||||
export const SearchPropertyLists: string = localize('SchemaCompare.SearchPropertyLists', "Search Property Lists");
|
|
||||||
export const SecurityPolicies: string = localize('SchemaCompare.SecurityPolicies', "Security Policies");
|
|
||||||
export const Sequences: string = localize('SchemaCompare.Sequences', "Sequences");
|
|
||||||
export const Services: string = localize('SchemaCompare.Services', "Services");
|
|
||||||
export const Signatures: string = localize('SchemaCompare.Signatures', "Signatures");
|
|
||||||
export const StoredProcedures: string = localize('SchemaCompare.StoredProcedures', "Stored Procedures");
|
|
||||||
export const SymmetricKeys: string = localize('SchemaCompare.SymmetricKeys', "Symmetric Keys");
|
|
||||||
export const Synonyms: string = localize('SchemaCompare.Synonyms', "Synonyms");
|
|
||||||
export const Tables: string = localize('SchemaCompare.Tables', "Tables");
|
|
||||||
export const TableValuedFunctions: string = localize('SchemaCompare.TableValuedFunctions', "Table Valued Functions");
|
|
||||||
export const UserDefinedDataTypes: string = localize('SchemaCompare.UserDefinedDataTypes', "User Defined Data Types");
|
|
||||||
export const UserDefinedTableTypes: string = localize('SchemaCompare.UserDefinedTableTypes', "User Defined Table Types");
|
|
||||||
export const ClrUserDefinedTypes: string = localize('SchemaCompare.ClrUserDefinedTypes', "Clr User Defined Types");
|
|
||||||
export const Users: string = localize('SchemaCompare.Users', "Users");
|
|
||||||
export const Views: string = localize('SchemaCompare.Views', "Views");
|
|
||||||
export const XmlSchemaCollections: string = localize('SchemaCompare.XmlSchemaCollections', "Xml Schema Collections");
|
|
||||||
export const Audits: string = localize('SchemaCompare.Audits', "Audits");
|
|
||||||
export const Credentials: string = localize('SchemaCompare.Credentials', "Credentials");
|
|
||||||
export const CryptographicProviders: string = localize('SchemaCompare.CryptographicProviders', "Cryptographic Providers");
|
|
||||||
export const DatabaseAuditSpecifications: string = localize('SchemaCompare.DatabaseAuditSpecifications', "Database Audit Specifications");
|
|
||||||
export const DatabaseEncryptionKeys: string = localize('SchemaCompare.DatabaseEncryptionKeys', "Database Encryption Keys");
|
|
||||||
export const DatabaseScopedCredentials: string = localize('SchemaCompare.DatabaseScopedCredentials', "Database Scoped Credentials");
|
|
||||||
export const Endpoints: string = localize('SchemaCompare.Endpoints', "Endpoints");
|
|
||||||
export const ErrorMessages: string = localize('SchemaCompare.ErrorMessages', "Error Messages");
|
|
||||||
export const EventNotifications: string = localize('SchemaCompare.EventNotifications', "Event Notifications");
|
|
||||||
export const EventSessions: string = localize('SchemaCompare.EventSessions', "Event Sessions");
|
|
||||||
export const LinkedServerLogins: string = localize('SchemaCompare.LinkedServerLogins', "Linked Server Logins");
|
|
||||||
export const LinkedServers: string = localize('SchemaCompare.LinkedServers', "Linked Servers");
|
|
||||||
export const Logins: string = localize('SchemaCompare.Logins', "Logins");
|
|
||||||
export const MasterKeys: string = localize('SchemaCompare.MasterKeys', "Master Keys");
|
|
||||||
export const Routes: string = localize('SchemaCompare.Routes', "Routes");
|
|
||||||
export const ServerAuditSpecifications: string = localize('SchemaCompare.ServerAuditSpecifications', "Server Audit Specifications");
|
|
||||||
export const ServerRoleMembership: string = localize('SchemaCompare.ServerRoleMembership', "Server Role Membership");
|
|
||||||
export const ServerRoles: string = localize('SchemaCompare.ServerRoles', "Server Roles");
|
|
||||||
export const ServerTriggers: string = localize('SchemaCompare.ServerTriggers', "Server Triggers");
|
|
||||||
|
|
||||||
// Error messages
|
// Error messages
|
||||||
export function compareErrorMessage(errorMessage: string): string { return localize('schemaCompare.compareErrorMessage', "Schema Compare failed: {0}", errorMessage ? errorMessage : 'Unknown'); }
|
export function compareErrorMessage(errorMessage: string): string { return localize('schemaCompare.compareErrorMessage', "Schema Compare failed: {0}", errorMessage ? errorMessage : 'Unknown'); }
|
||||||
export function saveScmpErrorMessage(errorMessage: string): string { return localize('schemaCompare.saveScmpErrorMessage', "Save scmp failed: '{0}'", (errorMessage) ? errorMessage : 'Unknown'); }
|
export function saveScmpErrorMessage(errorMessage: string): string { return localize('schemaCompare.saveScmpErrorMessage', "Save scmp failed: '{0}'", (errorMessage) ? errorMessage : 'Unknown'); }
|
||||||
|
|||||||
@@ -5,16 +5,15 @@
|
|||||||
import * as loc from '../localizedConstants';
|
import * as loc from '../localizedConstants';
|
||||||
import * as mssql from 'mssql';
|
import * as mssql from 'mssql';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { isNullOrUndefined } from 'util';
|
|
||||||
|
|
||||||
export class SchemaCompareOptionsModel {
|
export class SchemaCompareOptionsModel {
|
||||||
// key is the option display name and values are checkboxValue and optionName
|
// key is the option display name and values are checkboxValue and optionName
|
||||||
private optionsValueNameLookup: { [key: string]: mssql.IOptionWithValue } = {};
|
private optionsValueNameLookup: { [key: string]: mssql.IOptionWithValue } = {};
|
||||||
public excludedObjectTypes: number[] = [];
|
private includeObjectTypesLookup: { [key: string]: mssql.IOptionWithValue } = {};
|
||||||
public objectsLookup = {};
|
|
||||||
|
|
||||||
constructor(public deploymentOptions: mssql.DeploymentOptions) {
|
constructor(public deploymentOptions: mssql.DeploymentOptions) {
|
||||||
this.setOptionsToValueNameLookup();
|
this.setOptionsToValueNameLookup();
|
||||||
|
this.setIncludeObjectTypesLookup();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -72,590 +71,62 @@ export class SchemaCompareOptionsModel {
|
|||||||
return optionName !== undefined ? this.deploymentOptions.booleanOptionsDictionary[optionName.optionName].description : '';
|
return optionName !== undefined ? this.deploymentOptions.booleanOptionsDictionary[optionName.optionName].description : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
//#region Schema Compare Objects
|
/*
|
||||||
public objectTypeLabels: string[] = [
|
* Sets include object types option's checkbox values and property name to the includeObjectTypesLookup map
|
||||||
loc.Aggregates,
|
*/
|
||||||
loc.ApplicationRoles,
|
public setIncludeObjectTypesLookup(): void {
|
||||||
loc.Assemblies,
|
Object.entries(this.deploymentOptions.objectTypesDictionary).forEach(option => {
|
||||||
loc.AssemblyFiles,
|
const optionValue: mssql.IOptionWithValue = {
|
||||||
loc.AsymmetricKeys,
|
optionName: option[0],
|
||||||
loc.BrokerPriorities,
|
checked: this.getIncludeObjectTypeOptionCheckStatus(option[0])
|
||||||
loc.Certificates,
|
};
|
||||||
loc.ColumnEncryptionKeys,
|
this.includeObjectTypesLookup[option[1]] = optionValue;
|
||||||
loc.ColumnMasterKeys,
|
|
||||||
loc.Contracts,
|
|
||||||
loc.DatabaseOptions,
|
|
||||||
loc.DatabaseRoles,
|
|
||||||
loc.DatabaseTriggers,
|
|
||||||
loc.Defaults,
|
|
||||||
loc.ExtendedProperties,
|
|
||||||
loc.ExternalDataSources,
|
|
||||||
loc.ExternalFileFormats,
|
|
||||||
loc.ExternalStreams,
|
|
||||||
loc.ExternalStreamingJobs,
|
|
||||||
loc.ExternalTables,
|
|
||||||
loc.Filegroups,
|
|
||||||
loc.Files,
|
|
||||||
loc.FileTables,
|
|
||||||
loc.FullTextCatalogs,
|
|
||||||
loc.FullTextStoplists,
|
|
||||||
loc.MessageTypes,
|
|
||||||
loc.PartitionFunctions,
|
|
||||||
loc.PartitionSchemes,
|
|
||||||
loc.Permissions,
|
|
||||||
loc.Queues,
|
|
||||||
loc.RemoteServiceBindings,
|
|
||||||
loc.RoleMembership,
|
|
||||||
loc.Rules,
|
|
||||||
loc.ScalarValuedFunctions,
|
|
||||||
loc.SearchPropertyLists,
|
|
||||||
loc.SecurityPolicies,
|
|
||||||
loc.Sequences,
|
|
||||||
loc.Services,
|
|
||||||
loc.Signatures,
|
|
||||||
loc.StoredProcedures,
|
|
||||||
loc.SymmetricKeys,
|
|
||||||
loc.Synonyms,
|
|
||||||
loc.Tables,
|
|
||||||
loc.TableValuedFunctions,
|
|
||||||
loc.UserDefinedDataTypes,
|
|
||||||
loc.UserDefinedTableTypes,
|
|
||||||
loc.ClrUserDefinedTypes,
|
|
||||||
loc.Users,
|
|
||||||
loc.Views,
|
|
||||||
loc.XmlSchemaCollections,
|
|
||||||
loc.Audits,
|
|
||||||
loc.Credentials,
|
|
||||||
loc.CryptographicProviders,
|
|
||||||
loc.DatabaseAuditSpecifications,
|
|
||||||
loc.DatabaseEncryptionKeys,
|
|
||||||
loc.DatabaseScopedCredentials,
|
|
||||||
loc.Endpoints,
|
|
||||||
loc.ErrorMessages,
|
|
||||||
loc.EventNotifications,
|
|
||||||
loc.EventSessions,
|
|
||||||
loc.LinkedServerLogins,
|
|
||||||
loc.LinkedServers,
|
|
||||||
loc.Logins,
|
|
||||||
loc.MasterKeys,
|
|
||||||
loc.Routes,
|
|
||||||
loc.ServerAuditSpecifications,
|
|
||||||
loc.ServerRoleMembership,
|
|
||||||
loc.ServerRoles,
|
|
||||||
loc.ServerTriggers
|
|
||||||
].sort();
|
|
||||||
|
|
||||||
public getObjectsData(): string[][] {
|
|
||||||
let data = [];
|
|
||||||
this.objectsLookup = {};
|
|
||||||
this.objectTypeLabels.forEach(l => {
|
|
||||||
let checked: boolean = this.getSchemaCompareIncludedObjectsUtil(l);
|
|
||||||
data.push([checked, l]);
|
|
||||||
this.objectsLookup[l] = checked;
|
|
||||||
});
|
});
|
||||||
return data;
|
|
||||||
}
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
|
|
||||||
public setObjectTypeOptions() {
|
|
||||||
for (let option in this.objectsLookup) {
|
|
||||||
this.setSchemaCompareIncludedObjectsUtil(option, this.objectsLookup[option]);
|
|
||||||
}
|
|
||||||
this.deploymentOptions.excludeObjectTypes.value = this.excludedObjectTypes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getSchemaCompareIncludedObjectsUtil(label): boolean {
|
/*
|
||||||
switch (label) {
|
* Initialize options data from include objects options for table component
|
||||||
case loc.Aggregates:
|
* Returns data as [booleanValue, optionName]
|
||||||
return !isNullOrUndefined(this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Aggregates)) ? false : true;
|
*/
|
||||||
case loc.ApplicationRoles:
|
public getIncludeObjectTypesOptionsData(): any[][] {
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ApplicationRoles)) ? false : true;
|
let data: any[][] = [];
|
||||||
case loc.Assemblies:
|
Object.entries(this.deploymentOptions.objectTypesDictionary).forEach(option => {
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Assemblies)) ? false : true;
|
// option[1] is the display name and option[0] is the optionName
|
||||||
case loc.AssemblyFiles:
|
data.push([this.getIncludeObjectTypeOptionCheckStatus(option[0]), option[1]]);
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.AssemblyFiles)) ? false : true;
|
});
|
||||||
case loc.AsymmetricKeys:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.AsymmetricKeys)) ? false : true;
|
return data.sort((a, b) => a[1].localeCompare(b[1]));
|
||||||
case loc.BrokerPriorities:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.BrokerPriorities)) ? false : true;
|
|
||||||
case loc.Certificates:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Certificates)) ? false : true;
|
|
||||||
case loc.ColumnEncryptionKeys:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ColumnEncryptionKeys)) ? false : true;
|
|
||||||
case loc.ColumnMasterKeys:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ColumnMasterKeys)) ? false : true;
|
|
||||||
case loc.Contracts:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Contracts)) ? false : true;
|
|
||||||
case loc.DatabaseOptions:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.DatabaseOptions)) ? false : true;
|
|
||||||
case loc.DatabaseRoles:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.DatabaseRoles)) ? false : true;
|
|
||||||
case loc.DatabaseTriggers:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.DatabaseTriggers)) ? false : true;
|
|
||||||
case loc.Defaults:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Defaults)) ? false : true;
|
|
||||||
case loc.ExtendedProperties:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ExtendedProperties)) ? false : true;
|
|
||||||
case loc.ExternalDataSources:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ExternalDataSources)) ? false : true;
|
|
||||||
case loc.ExternalFileFormats:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ExternalFileFormats)) ? false : true;
|
|
||||||
case loc.ExternalStreams:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ExternalStreams)) ? false : true;
|
|
||||||
case loc.ExternalStreamingJobs:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ExternalStreamingJobs)) ? false : true;
|
|
||||||
case loc.ExternalTables:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ExternalTables)) ? false : true;
|
|
||||||
case loc.Filegroups:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Filegroups)) ? false : true;
|
|
||||||
case loc.Files:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Files)) ? false : true;
|
|
||||||
case loc.FileTables:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.FileTables)) ? false : true;
|
|
||||||
case loc.FullTextCatalogs:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.FullTextCatalogs)) ? false : true;
|
|
||||||
case loc.FullTextStoplists:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.FullTextStoplists)) ? false : true;
|
|
||||||
case loc.MessageTypes:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.MessageTypes)) ? false : true;
|
|
||||||
case loc.PartitionFunctions:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.PartitionFunctions)) ? false : true;
|
|
||||||
case loc.PartitionSchemes:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.PartitionSchemes)) ? false : true;
|
|
||||||
case loc.Permissions:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Permissions)) ? false : true;
|
|
||||||
case loc.Queues:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Queues)) ? false : true;
|
|
||||||
case loc.RemoteServiceBindings:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.RemoteServiceBindings)) ? false : true;
|
|
||||||
case loc.RoleMembership:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.RoleMembership)) ? false : true;
|
|
||||||
case loc.Rules:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Rules)) ? false : true;
|
|
||||||
case loc.ScalarValuedFunctions:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ScalarValuedFunctions)) ? false : true;
|
|
||||||
case loc.SearchPropertyLists:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.SearchPropertyLists)) ? false : true;
|
|
||||||
case loc.SecurityPolicies:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.SecurityPolicies)) ? false : true;
|
|
||||||
case loc.Sequences:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Sequences)) ? false : true;
|
|
||||||
case loc.Services:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Services)) ? false : true;
|
|
||||||
case loc.Signatures:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Signatures)) ? false : true;
|
|
||||||
case loc.StoredProcedures:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.StoredProcedures)) ? false : true;
|
|
||||||
case loc.SymmetricKeys:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.SymmetricKeys)) ? false : true;
|
|
||||||
case loc.Synonyms:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Synonyms)) ? false : true;
|
|
||||||
case loc.Tables:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Tables)) ? false : true;
|
|
||||||
case loc.TableValuedFunctions:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.TableValuedFunctions)) ? false : true;
|
|
||||||
case loc.UserDefinedDataTypes:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.UserDefinedDataTypes)) ? false : true;
|
|
||||||
case loc.UserDefinedTableTypes:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.UserDefinedTableTypes)) ? false : true;
|
|
||||||
case loc.ClrUserDefinedTypes:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ClrUserDefinedTypes)) ? false : true;
|
|
||||||
case loc.Users:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Users)) ? false : true;
|
|
||||||
case loc.Views:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Views)) ? false : true;
|
|
||||||
case loc.XmlSchemaCollections:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.XmlSchemaCollections)) ? false : true;
|
|
||||||
case loc.Audits:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Audits)) ? false : true;
|
|
||||||
case loc.Credentials:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Credentials)) ? false : true;
|
|
||||||
case loc.CryptographicProviders:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.CryptographicProviders)) ? false : true;
|
|
||||||
case loc.DatabaseAuditSpecifications:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.DatabaseAuditSpecifications)) ? false : true;
|
|
||||||
case loc.DatabaseEncryptionKeys:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.DatabaseEncryptionKeys)) ? false : true;
|
|
||||||
case loc.DatabaseScopedCredentials:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.DatabaseScopedCredentials)) ? false : true;
|
|
||||||
case loc.Endpoints:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Endpoints)) ? false : true;
|
|
||||||
case loc.ErrorMessages:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ErrorMessages)) ? false : true;
|
|
||||||
case loc.EventNotifications:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.EventNotifications)) ? false : true;
|
|
||||||
case loc.EventSessions:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.EventSessions)) ? false : true;
|
|
||||||
case loc.LinkedServerLogins:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.LinkedServerLogins)) ? false : true;
|
|
||||||
case loc.LinkedServers:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.LinkedServers)) ? false : true;
|
|
||||||
case loc.Logins:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Logins)) ? false : true;
|
|
||||||
case loc.MasterKeys:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.MasterKeys)) ? false : true;
|
|
||||||
case loc.Routes:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.Routes)) ? false : true;
|
|
||||||
case loc.ServerAuditSpecifications:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ServerAuditSpecifications)) ? false : true;
|
|
||||||
case loc.ServerRoleMembership:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ServerRoleMembership)) ? false : true;
|
|
||||||
case loc.ServerRoles:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ServerRoles)) ? false : true;
|
|
||||||
case loc.ServerTriggers:
|
|
||||||
return (this.deploymentOptions.excludeObjectTypes.value.find(x => x === mssql.SchemaObjectType.ServerTriggers)) ? false : true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public setSchemaCompareIncludedObjectsUtil(label: string, included: boolean) {
|
/*
|
||||||
switch (label) {
|
* Gets the selected/default value of the object type option
|
||||||
case loc.Aggregates:
|
* return false for the deploymentOptions.excludeObjectTypes option, if it is in ObjectTypesDictionary
|
||||||
if (!included) {
|
*/
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Aggregates);
|
public getIncludeObjectTypeOptionCheckStatus(optionName: string): boolean {
|
||||||
}
|
return (this.deploymentOptions.excludeObjectTypes.value?.find(x => x.toLowerCase() === optionName.toLowerCase())) !== undefined ? false : true;
|
||||||
return;
|
}
|
||||||
case loc.ApplicationRoles:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ApplicationRoles);
|
/*
|
||||||
}
|
* Sets the checkbox value to the includeObjectTypesLookup map
|
||||||
return;
|
*/
|
||||||
case loc.Assemblies:
|
public setIncludeObjectTypesOptionValue(displayName: string, checked: boolean): void {
|
||||||
if (!included) {
|
this.includeObjectTypesLookup[displayName].checked = checked;
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Assemblies);
|
}
|
||||||
}
|
|
||||||
return;
|
/*
|
||||||
case loc.AssemblyFiles:
|
* Sets the selected option checkbox value to the deployment options
|
||||||
if (!included) {
|
*/
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.AssemblyFiles);
|
public setIncludeObjectTypesToDeploymentOptions(): void {
|
||||||
}
|
let finalExcludedObjectTypes: string[] = [];
|
||||||
return;
|
Object.entries(this.includeObjectTypesLookup).forEach(option => {
|
||||||
case loc.AsymmetricKeys:
|
// option[1] holds checkedbox value and optionName
|
||||||
if (!included) {
|
// sending the unchecked(false) options only to the excludeObjectTypes
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.AsymmetricKeys);
|
if (!option[1].checked) {
|
||||||
}
|
finalExcludedObjectTypes.push(option[1].optionName);
|
||||||
return;
|
}
|
||||||
case loc.BrokerPriorities:
|
});
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.BrokerPriorities);
|
this.deploymentOptions.excludeObjectTypes.value = finalExcludedObjectTypes;
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Certificates:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Certificates);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.ColumnEncryptionKeys:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ColumnEncryptionKeys);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.ColumnMasterKeys:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ColumnMasterKeys);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Contracts:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Contracts);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.DatabaseOptions:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.DatabaseOptions);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.DatabaseRoles:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.DatabaseRoles);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.DatabaseTriggers:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.DatabaseTriggers);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Defaults:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Defaults);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.ExtendedProperties:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ExtendedProperties);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.ExternalDataSources:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ExternalDataSources);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.ExternalFileFormats:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ExternalFileFormats);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.ExternalStreams:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ExternalStreams);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.ExternalStreamingJobs:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ExternalStreamingJobs);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.ExternalTables:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ExternalTables);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Filegroups:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Filegroups);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Files:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Files);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.FileTables:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.FileTables);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.FullTextCatalogs:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.FullTextCatalogs);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.FullTextStoplists:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.FullTextStoplists);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.MessageTypes:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.MessageTypes);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.PartitionFunctions:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.PartitionFunctions);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.PartitionSchemes:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.PartitionSchemes);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Permissions:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Permissions);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Queues:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Queues);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.RemoteServiceBindings:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.RemoteServiceBindings);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.RoleMembership:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.RoleMembership);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Rules:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Rules);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.ScalarValuedFunctions:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ScalarValuedFunctions);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.SearchPropertyLists:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.SearchPropertyLists);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.SecurityPolicies:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.SecurityPolicies);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Sequences:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Sequences);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Services:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Services);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Signatures:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Signatures);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.StoredProcedures:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.StoredProcedures);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.SymmetricKeys:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.SymmetricKeys);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Synonyms:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Synonyms);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Tables:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Tables);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.TableValuedFunctions:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.TableValuedFunctions);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.UserDefinedDataTypes:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.UserDefinedDataTypes);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.UserDefinedTableTypes:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.UserDefinedTableTypes);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.ClrUserDefinedTypes:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ClrUserDefinedTypes);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Users:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Users);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Views:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Views);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.XmlSchemaCollections:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.XmlSchemaCollections);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Audits:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Audits);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Credentials:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Credentials);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.CryptographicProviders:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.CryptographicProviders);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.DatabaseAuditSpecifications:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.DatabaseAuditSpecifications);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.DatabaseEncryptionKeys:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.DatabaseEncryptionKeys);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.DatabaseScopedCredentials:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.DatabaseScopedCredentials);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Endpoints:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Endpoints);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.ErrorMessages:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ErrorMessages);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.EventNotifications:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.EventNotifications);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.EventSessions:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.EventSessions);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.LinkedServerLogins:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.LinkedServerLogins);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.LinkedServers:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.LinkedServers);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Logins:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Logins);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.MasterKeys:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.MasterKeys);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.Routes:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Routes);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.ServerAuditSpecifications:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ServerAuditSpecifications);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.ServerRoleMembership:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ServerRoleMembership);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.ServerRoles:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ServerRoles);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case loc.ServerTriggers:
|
|
||||||
if (!included) {
|
|
||||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ServerTriggers);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,30 +11,42 @@ describe('Schema Compare Options Model', () => {
|
|||||||
it('Should create model and set options successfully', function (): void {
|
it('Should create model and set options successfully', function (): void {
|
||||||
const model = new SchemaCompareOptionsModel(testUtils.getDeploymentOptions());
|
const model = new SchemaCompareOptionsModel(testUtils.getDeploymentOptions());
|
||||||
should.notEqual(model.getOptionsData(), undefined, 'Options shouldn\'t be undefined');
|
should.notEqual(model.getOptionsData(), undefined, 'Options shouldn\'t be undefined');
|
||||||
should.notEqual(model.getObjectsData(), undefined, 'Objects shouldn\'t be undefined');
|
should.notEqual(model.getIncludeObjectTypesOptionsData(), undefined, 'Objects shouldn\'t be undefined');
|
||||||
|
|
||||||
should.doesNotThrow(() => model.setDeploymentOptions());
|
should.doesNotThrow(() => model.setDeploymentOptions());
|
||||||
should.doesNotThrow(() => model.setObjectTypeOptions());
|
should.doesNotThrow(() => model.setIncludeObjectTypesToDeploymentOptions());
|
||||||
|
|
||||||
should(model.getSchemaCompareIncludedObjectsUtil('')).be.false('Should return false if invalid object name is passed in');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should exclude objects', function (): void {
|
it('Should not have a default object types to exclude from IncludeObjectTypes ', function (): void {
|
||||||
const model = new SchemaCompareOptionsModel(testUtils.getDeploymentOptions());
|
const model = new SchemaCompareOptionsModel(testUtils.getDeploymentOptions());
|
||||||
should(model.excludedObjectTypes.length).be.equal(0, 'There should be no excluded objects');
|
should(model.deploymentOptions.excludeObjectTypes.value.length).be.equal(0, 'There should be no object type excluded from IncludeObjectTypes');
|
||||||
|
|
||||||
model.objectTypeLabels.forEach(label => {
|
Object.keys(model.deploymentOptions.objectTypesDictionary).forEach(option => {
|
||||||
model.setSchemaCompareIncludedObjectsUtil(label, false);
|
should(model.getIncludeObjectTypeOptionCheckStatus(option)).equal(true, 'Object types that are not excluded should return true');
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
should(model.excludedObjectTypes.length).be.equal(model.objectTypeLabels.length, 'All the object types should be excluded');
|
it('Should have default object types to exclude from IncludeObjectTypes ', function (): void {
|
||||||
|
const model = new SchemaCompareOptionsModel(testUtils.getDeploymentOptions());
|
||||||
|
model.deploymentOptions.excludeObjectTypes.value = ['SampleProperty1'];
|
||||||
|
|
||||||
|
should(model.deploymentOptions.excludeObjectTypes.value.length).be.equal(1, 'There should be one object type excluding from IncludeObjectTypes ');
|
||||||
|
|
||||||
|
// should return false for the default object types and false for the remaining object types
|
||||||
|
Object.keys(model.deploymentOptions.objectTypesDictionary).forEach(option => {
|
||||||
|
if (option === 'SampleProperty1') {
|
||||||
|
should(model.getIncludeObjectTypeOptionCheckStatus(option)).equal(false, 'Object type property that have default object types to exclude from IncludeObjectTypes should return false');
|
||||||
|
} else {
|
||||||
|
should(model.getIncludeObjectTypeOptionCheckStatus(option)).equal(true, 'All including Object type should return true');
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should get descriptions', function (): void {
|
it('Should get descriptions', function (): void {
|
||||||
const model = new SchemaCompareOptionsModel(testUtils.getDeploymentOptions());
|
const model = new SchemaCompareOptionsModel(testUtils.getDeploymentOptions());
|
||||||
model.getOptionsData();
|
model.getOptionsData();
|
||||||
Object.entries(model.deploymentOptions.booleanOptionsDictionary).forEach(option => {
|
Object.entries(model.deploymentOptions.booleanOptionsDictionary).forEach(option => {
|
||||||
should(model.getOptionDescription(option[1].displayName)).not.equal(undefined);
|
should(model.getOptionDescription(option[1].displayName)).not.equal(undefined, 'Option description shouldn\'t be undefined');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ export function getDeploymentOptions(): mssql.DeploymentOptions {
|
|||||||
'SampleDisplayOption1': { value: false, description: sampleDesc, displayName: sampleName },
|
'SampleDisplayOption1': { value: false, description: sampleDesc, displayName: sampleName },
|
||||||
'SampleDisplayOption2': { value: false, description: sampleDesc, displayName: sampleName }
|
'SampleDisplayOption2': { value: false, description: sampleDesc, displayName: sampleName }
|
||||||
},
|
},
|
||||||
includeObjectsDictionary: {
|
objectTypesDictionary: {
|
||||||
'SampleProperty1': sampleName,
|
'SampleProperty1': sampleName,
|
||||||
'SampleProperty2': sampleName
|
'SampleProperty2': sampleName
|
||||||
}
|
}
|
||||||
|
|||||||
77
extensions/types/vscode-mssql.d.ts
vendored
77
extensions/types/vscode-mssql.d.ts
vendored
@@ -515,85 +515,10 @@ declare module 'vscode-mssql' {
|
|||||||
excludeObjectTypes: DacDeployOptionPropertyObject;
|
excludeObjectTypes: DacDeployOptionPropertyObject;
|
||||||
// key will be the boolean option name
|
// key will be the boolean option name
|
||||||
booleanOptionsDictionary: { [key: string]: DacDeployOptionPropertyBoolean };
|
booleanOptionsDictionary: { [key: string]: DacDeployOptionPropertyBoolean };
|
||||||
// key will be the object type enum name(nothing but option name)
|
// key will be the object type enum name (nothing but option name)
|
||||||
objectTypesDictionary: { [key: string]: string };
|
objectTypesDictionary: { [key: string]: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Values from <DacFx>\Product\Source\DeploymentApi\ObjectTypes.cs
|
|
||||||
*/
|
|
||||||
export const enum SchemaObjectType {
|
|
||||||
Aggregates = 0,
|
|
||||||
ApplicationRoles = 1,
|
|
||||||
Assemblies = 2,
|
|
||||||
AssemblyFiles = 3,
|
|
||||||
AsymmetricKeys = 4,
|
|
||||||
BrokerPriorities = 5,
|
|
||||||
Certificates = 6,
|
|
||||||
ColumnEncryptionKeys = 7,
|
|
||||||
ColumnMasterKeys = 8,
|
|
||||||
Contracts = 9,
|
|
||||||
DatabaseOptions = 10,
|
|
||||||
DatabaseRoles = 11,
|
|
||||||
DatabaseTriggers = 12,
|
|
||||||
Defaults = 13,
|
|
||||||
ExtendedProperties = 14,
|
|
||||||
ExternalDataSources = 15,
|
|
||||||
ExternalFileFormats = 16,
|
|
||||||
ExternalTables = 17,
|
|
||||||
Filegroups = 18,
|
|
||||||
Files = 19,
|
|
||||||
FileTables = 20,
|
|
||||||
FullTextCatalogs = 21,
|
|
||||||
FullTextStoplists = 22,
|
|
||||||
MessageTypes = 23,
|
|
||||||
PartitionFunctions = 24,
|
|
||||||
PartitionSchemes = 25,
|
|
||||||
Permissions = 26,
|
|
||||||
Queues = 27,
|
|
||||||
RemoteServiceBindings = 28,
|
|
||||||
RoleMembership = 29,
|
|
||||||
Rules = 30,
|
|
||||||
ScalarValuedFunctions = 31,
|
|
||||||
SearchPropertyLists = 32,
|
|
||||||
SecurityPolicies = 33,
|
|
||||||
Sequences = 34,
|
|
||||||
Services = 35,
|
|
||||||
Signatures = 36,
|
|
||||||
StoredProcedures = 37,
|
|
||||||
SymmetricKeys = 38,
|
|
||||||
Synonyms = 39,
|
|
||||||
Tables = 40,
|
|
||||||
TableValuedFunctions = 41,
|
|
||||||
UserDefinedDataTypes = 42,
|
|
||||||
UserDefinedTableTypes = 43,
|
|
||||||
ClrUserDefinedTypes = 44,
|
|
||||||
Users = 45,
|
|
||||||
Views = 46,
|
|
||||||
XmlSchemaCollections = 47,
|
|
||||||
Audits = 48,
|
|
||||||
Credentials = 49,
|
|
||||||
CryptographicProviders = 50,
|
|
||||||
DatabaseAuditSpecifications = 51,
|
|
||||||
DatabaseEncryptionKeys = 52,
|
|
||||||
DatabaseScopedCredentials = 53,
|
|
||||||
Endpoints = 54,
|
|
||||||
ErrorMessages = 55,
|
|
||||||
EventNotifications = 56,
|
|
||||||
EventSessions = 57,
|
|
||||||
LinkedServerLogins = 58,
|
|
||||||
LinkedServers = 59,
|
|
||||||
Logins = 60,
|
|
||||||
MasterKeys = 61,
|
|
||||||
Routes = 62,
|
|
||||||
ServerAuditSpecifications = 63,
|
|
||||||
ServerRoleMembership = 64,
|
|
||||||
ServerRoles = 65,
|
|
||||||
ServerTriggers = 66,
|
|
||||||
ExternalStreams = 67,
|
|
||||||
ExternalStreamingJobs = 68
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResultStatus from d.ts
|
* ResultStatus from d.ts
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user