mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Remove dacfx and schema compare from the azdata api (#6684)
* refactor mssql extension to directly expose dacfx and schema compare * remove more code * fix compile errors
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
import * as nls from 'vscode-nls';
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import * as mssql from '../../mssql/src/api/mssqlapis';
|
||||
import * as mssql from '../../mssql';
|
||||
import * as Utils from './cmsResource/utils';
|
||||
import { ICmsResourceNodeInfo } from './cmsResource/tree/baseTreeNodes';
|
||||
|
||||
@@ -37,7 +37,7 @@ export class CmsUtils {
|
||||
}
|
||||
|
||||
private _credentialProvider: azdata.CredentialProvider;
|
||||
private _cmsService: mssql.CmsService;
|
||||
private _cmsService: mssql.ICmsService;
|
||||
private _registeredCmsServers: ICmsResourceNodeInfo[] = [];
|
||||
|
||||
public async savePassword(username: string, password: string): Promise<boolean> {
|
||||
@@ -82,10 +82,9 @@ export class CmsUtils {
|
||||
}
|
||||
|
||||
// CMS APIs
|
||||
public async getCmsService(): Promise<mssql.CmsService> {
|
||||
public async getCmsService(): Promise<mssql.ICmsService> {
|
||||
if (!this._cmsService) {
|
||||
let extensionApi: mssql.MssqlExtensionApi = vscode.extensions.getExtension('Microsoft.mssql').exports;
|
||||
this._cmsService = await extensionApi.getCmsServiceProvider();
|
||||
this._cmsService = (vscode.extensions.getExtension(mssql.extension.name).exports as mssql.mssql).cmsService;
|
||||
}
|
||||
return this._cmsService;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import { ExtractConfigPage } from './pages/extractConfigPage';
|
||||
import { ImportConfigPage } from './pages/importConfigPage';
|
||||
import { DacFxDataModel } from './api/models';
|
||||
import { BasePage } from './api/basePage';
|
||||
import * as mssql from '../../../mssql';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
const msSqlProvider = 'MSSQL';
|
||||
@@ -369,8 +370,8 @@ export class DataTierApplicationWizard {
|
||||
return result.report;
|
||||
}
|
||||
|
||||
private static async getService(providerName: string): Promise<azdata.DacFxServicesProvider> {
|
||||
const service = azdata.dataprotocol.getProvider<azdata.DacFxServicesProvider>(providerName, azdata.DataProviderType.DacFxServicesProvider);
|
||||
private static async getService(providerName: string): Promise<mssql.IDacFxService> {
|
||||
const service = (vscode.extensions.getExtension(mssql.extension.name).exports as mssql.mssql).dacFx;
|
||||
return service;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
import 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import * as mssql from '../../mssql/src/api/mssqlapis';
|
||||
import * as mssql from '../../mssql';
|
||||
import * as utils from './utils';
|
||||
import * as uuid from 'uuid';
|
||||
import { context } from './testContext';
|
||||
import assert = require('assert');
|
||||
import { getStandaloneServer, TestServerProfile, getBdcServer } from './testConfig';
|
||||
|
||||
let cmsService: mssql.CmsService;
|
||||
let cmsService: mssql.ICmsService;
|
||||
let server: TestServerProfile;
|
||||
let connectionId: string;
|
||||
let ownerUri: string;
|
||||
@@ -31,8 +31,7 @@ if (context.RunTest) {
|
||||
setup(async function () {
|
||||
// Set up CMS provider
|
||||
if (!cmsService) {
|
||||
let api: mssql.MssqlExtensionApi = await vscode.extensions.getExtension('Microsoft.mssql').activate();
|
||||
cmsService = await api.getCmsServiceProvider();
|
||||
cmsService = ((await vscode.extensions.getExtension(mssql.extension.name).activate() as mssql.mssql)).cmsService;
|
||||
assert(cmsService !== undefined);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ import * as utils from './utils';
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import * as mssql from '../../mssql';
|
||||
import * as vscode from 'vscode';
|
||||
import { context } from './testContext';
|
||||
import { getStandaloneServer } from './testConfig';
|
||||
import assert = require('assert');
|
||||
@@ -34,7 +36,7 @@ if (context.RunTest) {
|
||||
const databaseName = 'ADS_deployDacpac_' + now.getTime().toString();
|
||||
|
||||
try {
|
||||
const dacfxService = await azdata.dataprotocol.getProvider<azdata.DacFxServicesProvider>('MSSQL', azdata.DataProviderType.DacFxServicesProvider);
|
||||
const dacfxService = ((await vscode.extensions.getExtension(mssql.extension.name).activate() as mssql.mssql)).dacFx;
|
||||
assert(dacfxService, 'DacFx Service Provider is not available');
|
||||
|
||||
// Deploy dacpac
|
||||
@@ -70,7 +72,7 @@ if (context.RunTest) {
|
||||
const databaseName = 'ADS_importBacpac_' + now.getTime().toString();
|
||||
|
||||
try {
|
||||
let dacfxService = await azdata.dataprotocol.getProvider<azdata.DacFxServicesProvider>('MSSQL', azdata.DataProviderType.DacFxServicesProvider);
|
||||
let dacfxService = ((await vscode.extensions.getExtension(mssql.extension.name).activate() as mssql.mssql)).dacFx;
|
||||
assert(dacfxService, 'DacFx Service Provider is not available');
|
||||
|
||||
// Import bacpac
|
||||
|
||||
@@ -52,9 +52,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
const features_mssql: azdata.DataProviderType[] = [
|
||||
azdata.DataProviderType.AgentServicesProvider,
|
||||
azdata.DataProviderType.DacFxServicesProvider,
|
||||
azdata.DataProviderType.IconProvider,
|
||||
azdata.DataProviderType.SchemaCompareServicesProvider
|
||||
azdata.DataProviderType.IconProvider
|
||||
];
|
||||
|
||||
features_mssql.push(...commonFeatures);
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
|
||||
import 'mocha';
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import * as utils from './utils';
|
||||
import * as mssql from '../../mssql';
|
||||
import * as os from 'os';
|
||||
import * as fs from 'fs';
|
||||
const path = require('path');
|
||||
@@ -16,7 +18,7 @@ import assert = require('assert');
|
||||
import { getStandaloneServer } from './testConfig';
|
||||
import { stressify } from 'adstest';
|
||||
|
||||
let schemaCompareService: azdata.SchemaCompareServicesProvider;
|
||||
let schemaCompareService: mssql.ISchemaCompareService;
|
||||
let schemaCompareTester: SchemaCompareTester;
|
||||
let dacpac1: string = path.join(__dirname, 'testData/Database1.dacpac');
|
||||
let dacpac2: string = path.join(__dirname, 'testData/Database2.dacpac');
|
||||
@@ -29,7 +31,7 @@ if (context.RunTest) {
|
||||
suiteSetup(async function () {
|
||||
let attempts: number = 20;
|
||||
while (attempts > 0) {
|
||||
schemaCompareService = await azdata.dataprotocol.getProvider<azdata.SchemaCompareServicesProvider>('MSSQL', azdata.DataProviderType.SchemaCompareServicesProvider);
|
||||
schemaCompareService = ((await vscode.extensions.getExtension(mssql.extension.name).activate() as mssql.mssql)).schemaCompare;
|
||||
if (schemaCompareService) {
|
||||
break;
|
||||
}
|
||||
@@ -60,8 +62,8 @@ class SchemaCompareTester {
|
||||
const now = new Date();
|
||||
const operationId = 'testOperationId_' + now.getTime().toString();
|
||||
|
||||
let source: azdata.SchemaCompareEndpointInfo = {
|
||||
endpointType: azdata.SchemaCompareEndpointType.Dacpac,
|
||||
let source: mssql.SchemaCompareEndpointInfo = {
|
||||
endpointType: mssql.SchemaCompareEndpointType.Dacpac,
|
||||
packageFilePath: dacpac1,
|
||||
serverDisplayName: '',
|
||||
serverName: '',
|
||||
@@ -69,8 +71,8 @@ class SchemaCompareTester {
|
||||
ownerUri: '',
|
||||
connectionDetails: undefined
|
||||
};
|
||||
let target: azdata.SchemaCompareEndpointInfo = {
|
||||
endpointType: azdata.SchemaCompareEndpointType.Dacpac,
|
||||
let target: mssql.SchemaCompareEndpointInfo = {
|
||||
endpointType: mssql.SchemaCompareEndpointType.Dacpac,
|
||||
packageFilePath: dacpac2,
|
||||
serverDisplayName: '',
|
||||
serverName: '',
|
||||
@@ -117,7 +119,7 @@ class SchemaCompareTester {
|
||||
const targetDB: string = 'ads_schemaCompare_targetDB_' + now.getTime().toString();
|
||||
|
||||
try {
|
||||
let dacfxService = await azdata.dataprotocol.getProvider<azdata.DacFxServicesProvider>('MSSQL', azdata.DataProviderType.DacFxServicesProvider);
|
||||
let dacfxService = ((await vscode.extensions.getExtension(mssql.extension.name).activate() as mssql.mssql)).dacFx;
|
||||
assert(dacfxService, 'DacFx Service Provider is not available');
|
||||
let result1 = await dacfxService.deployDacpac(dacpac1, sourceDB, true, ownerUri, azdata.TaskExecutionMode.execute);
|
||||
let result2 = await dacfxService.deployDacpac(dacpac2, targetDB, true, ownerUri, azdata.TaskExecutionMode.execute);
|
||||
@@ -129,8 +131,8 @@ class SchemaCompareTester {
|
||||
|
||||
assert(schemaCompareService, 'Schema Compare Service Provider is not available');
|
||||
|
||||
let source: azdata.SchemaCompareEndpointInfo = {
|
||||
endpointType: azdata.SchemaCompareEndpointType.Database,
|
||||
let source: mssql.SchemaCompareEndpointInfo = {
|
||||
endpointType: mssql.SchemaCompareEndpointType.Database,
|
||||
packageFilePath: '',
|
||||
serverDisplayName: '',
|
||||
serverName: server.serverName,
|
||||
@@ -138,8 +140,8 @@ class SchemaCompareTester {
|
||||
ownerUri: ownerUri,
|
||||
connectionDetails: undefined
|
||||
};
|
||||
let target: azdata.SchemaCompareEndpointInfo = {
|
||||
endpointType: azdata.SchemaCompareEndpointType.Database,
|
||||
let target: mssql.SchemaCompareEndpointInfo = {
|
||||
endpointType: mssql.SchemaCompareEndpointType.Database,
|
||||
packageFilePath: '',
|
||||
serverDisplayName: '',
|
||||
serverName: server.serverName,
|
||||
@@ -197,14 +199,14 @@ class SchemaCompareTester {
|
||||
const targetDB: string = 'ads_schemaCompare_targetDB_' + now.getTime().toString();
|
||||
|
||||
try {
|
||||
let dacfxService = await azdata.dataprotocol.getProvider<azdata.DacFxServicesProvider>('MSSQL', azdata.DataProviderType.DacFxServicesProvider);
|
||||
let dacfxService = (vscode.extensions.getExtension('mssql').exports as mssql.mssql).dacFx;
|
||||
assert(dacfxService, 'DacFx Service Provider is not available');
|
||||
let result = await dacfxService.deployDacpac(path.join(__dirname, 'testData/Database2.dacpac'), targetDB, true, ownerUri, azdata.TaskExecutionMode.execute);
|
||||
|
||||
assert(result.success === true, 'Deploy database 2 (target) should succeed');
|
||||
|
||||
let source: azdata.SchemaCompareEndpointInfo = {
|
||||
endpointType: azdata.SchemaCompareEndpointType.Dacpac,
|
||||
let source: mssql.SchemaCompareEndpointInfo = {
|
||||
endpointType: mssql.SchemaCompareEndpointType.Dacpac,
|
||||
packageFilePath: dacpac1,
|
||||
serverDisplayName: '',
|
||||
serverName: '',
|
||||
@@ -212,8 +214,8 @@ class SchemaCompareTester {
|
||||
ownerUri: ownerUri,
|
||||
connectionDetails: undefined
|
||||
};
|
||||
let target: azdata.SchemaCompareEndpointInfo = {
|
||||
endpointType: azdata.SchemaCompareEndpointType.Database,
|
||||
let target: mssql.SchemaCompareEndpointInfo = {
|
||||
endpointType: mssql.SchemaCompareEndpointType.Database,
|
||||
packageFilePath: '',
|
||||
serverDisplayName: '',
|
||||
serverName: server.serverName,
|
||||
@@ -250,7 +252,7 @@ class SchemaCompareTester {
|
||||
}
|
||||
}
|
||||
|
||||
private assertSchemaCompareResult(schemaCompareResult: azdata.SchemaCompareResult, operationId: string): void {
|
||||
private assertSchemaCompareResult(schemaCompareResult: mssql.SchemaCompareResult, operationId: string): void {
|
||||
assert(schemaCompareResult.areEqual === false, `Expected: the schemas are not to be equal Actual: Equal`);
|
||||
assert(schemaCompareResult.errorMessage === null, `Expected: there should be no error. Actual Error message: "${schemaCompareResult.errorMessage}"`);
|
||||
assert(schemaCompareResult.success === true, `Expected: success in schema compare, Actual: Failure`);
|
||||
@@ -291,4 +293,4 @@ class SchemaCompareTester {
|
||||
assert(tasks !== null && tasks.tasks.length > 0, 'Tasks should still show in list. This is to ensure that the tasks actually complete.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
/// <reference path='../../../../src/sql/azdata.d.ts'/>
|
||||
/// <reference path='../../../../src/sql/azdata.proposed.d.ts'/>
|
||||
/// <reference path='../../../../src/sql/azdata.test.d.ts'/>
|
||||
/// <reference types='@types/node'/>
|
||||
/// <reference types='@types/node'/>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"vscode": "*"
|
||||
},
|
||||
"main": "./out/main",
|
||||
"typings": "./src/mssql",
|
||||
"extensionDependencies": [
|
||||
"vscode.sql"
|
||||
],
|
||||
|
||||
111
extensions/mssql/src/api/mssqlapis.d.ts
vendored
111
extensions/mssql/src/api/mssqlapis.d.ts
vendored
@@ -1,111 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
// This is the place for extensions to expose APIs.
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
/**
|
||||
* The APIs provided by Mssql extension
|
||||
*/
|
||||
export interface MssqlExtensionApi {
|
||||
/**
|
||||
* Gets the object explorer API that supports querying over the connections supported by this extension
|
||||
*
|
||||
*/
|
||||
getMssqlObjectExplorerBrowser(): MssqlObjectExplorerBrowser;
|
||||
|
||||
/**
|
||||
* Get the Cms Service APIs to communicate with CMS connections supported by this extension
|
||||
*
|
||||
*/
|
||||
getCmsServiceProvider(): Promise<CmsService>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A browser supporting actions over the object explorer connections provided by this extension.
|
||||
* Currently this is the
|
||||
*/
|
||||
export interface MssqlObjectExplorerBrowser {
|
||||
/**
|
||||
* Gets the matching node given a context object, e.g. one from a right-click on a node in Object Explorer
|
||||
*/
|
||||
getNode<T extends ITreeNode>(objectExplorerContext: azdata.ObjectExplorerContext): Promise<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A tree node in the object explorer tree
|
||||
*/
|
||||
export interface ITreeNode {
|
||||
getNodeInfo(): azdata.NodeInfo;
|
||||
getChildren(refreshChildren: boolean): ITreeNode[] | Promise<ITreeNode[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A HDFS file node. This is a leaf node in the object explorer tree, and its contents
|
||||
* can be queried
|
||||
*/
|
||||
export interface IFileNode extends ITreeNode {
|
||||
getFileContentsAsString(maxBytes?: number): Promise<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Interface containing all CMS related operations
|
||||
*/
|
||||
export interface CmsService {
|
||||
/**
|
||||
* Connects to or creates a Central management Server
|
||||
*/
|
||||
createCmsServer(name: string, description:string, connectiondetails: azdata.ConnectionInfo, ownerUri: string): Thenable<ListRegisteredServersResult>;
|
||||
|
||||
/**
|
||||
* gets all Registered Servers inside a CMS on a particular level
|
||||
*/
|
||||
getRegisteredServers(ownerUri: string, relativePath: string): Thenable<ListRegisteredServersResult>;
|
||||
|
||||
/**
|
||||
* Adds a Registered Server inside a CMS on a particular level
|
||||
*/
|
||||
addRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string, registeredServerDescription:string, connectionDetails:azdata.ConnectionInfo): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Removes a Registered Server inside a CMS on a particular level
|
||||
*/
|
||||
removeRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Adds a Server Group inside a CMS on a particular level
|
||||
*/
|
||||
addServerGroup (ownerUri: string, relativePath: string, groupName: string, groupDescription:string): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Removes a Server Group inside a CMS on a particular level
|
||||
*/
|
||||
removeServerGroup (ownerUri: string, relativePath: string, groupName: string): Thenable<boolean>;
|
||||
}
|
||||
|
||||
/**
|
||||
* CMS Result interfaces as passed back to Extensions
|
||||
*/
|
||||
export interface RegisteredServerResult {
|
||||
name: string;
|
||||
serverName: string;
|
||||
description: string;
|
||||
connectionDetails: azdata.ConnectionInfo;
|
||||
relativePath: string;
|
||||
}
|
||||
|
||||
export interface RegisteredServerGroup {
|
||||
name: string;
|
||||
description: string;
|
||||
relativePath: string;
|
||||
}
|
||||
|
||||
export interface ListRegisteredServersResult {
|
||||
registeredServersList: Array<RegisteredServerResult>;
|
||||
registeredServerGroups: Array<RegisteredServerGroup>;
|
||||
}
|
||||
@@ -14,15 +14,24 @@ import { ApiWrapper } from './apiWrapper';
|
||||
export class AppContext {
|
||||
|
||||
private serviceMap: Map<string, any> = new Map();
|
||||
|
||||
constructor(public readonly extensionContext: vscode.ExtensionContext, public readonly apiWrapper: ApiWrapper) {
|
||||
this.apiWrapper = apiWrapper || new ApiWrapper();
|
||||
}
|
||||
|
||||
public getService<T>(serviceName: string): T {
|
||||
return this.serviceMap.get(serviceName) as T;
|
||||
const service = this.serviceMap.get(serviceName) as T;
|
||||
if (!service) {
|
||||
console.warn('Service ', serviceName, ' is not registered');
|
||||
}
|
||||
return service;
|
||||
}
|
||||
|
||||
public registerService<T>(serviceName: string, service: T): void {
|
||||
this.serviceMap.set(serviceName, service);
|
||||
if (this.serviceMap.has(serviceName)) {
|
||||
console.warn('Multiple services ', serviceName, ' registered!');
|
||||
} else {
|
||||
this.serviceMap.set(serviceName, service);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,14 +9,29 @@ import * as azdata from 'azdata';
|
||||
import * as constants from '../constants';
|
||||
import * as contracts from '../contracts';
|
||||
import { AppContext } from '../appContext';
|
||||
import { ConnectParams } from 'dataprotocol-client/lib/protocol';
|
||||
import { SqlOpsDataClient } from 'dataprotocol-client';
|
||||
import { ListRegisteredServersResult } from '../api/mssqlapis';
|
||||
import { ConnectParams, ClientCapabilities } from 'dataprotocol-client/lib/protocol';
|
||||
import { SqlOpsDataClient, ISqlOpsFeature } from 'dataprotocol-client';
|
||||
import { ListRegisteredServersResult, ICmsService } from '../mssql';
|
||||
import * as Utils from '../utils';
|
||||
|
||||
export class CmsService {
|
||||
export class CmsService implements ICmsService {
|
||||
public static asFeature(context: AppContext): ISqlOpsFeature {
|
||||
return class extends CmsService {
|
||||
constructor(client: SqlOpsDataClient) {
|
||||
super(context, client);
|
||||
}
|
||||
|
||||
constructor(private appContext: AppContext, private client: SqlOpsDataClient) {
|
||||
this.appContext.registerService<CmsService>(constants.CmsService, this);
|
||||
fillClientCapabilities(capabilities: ClientCapabilities): void {
|
||||
Utils.ensure(capabilities, 'cms')!.cms = true;
|
||||
}
|
||||
|
||||
initialize(): void {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private constructor(context: AppContext, protected readonly client: SqlOpsDataClient) {
|
||||
context.registerService(constants.CmsService, this);
|
||||
}
|
||||
|
||||
createCmsServer(name: string, description: string, connectiondetails: azdata.ConnectionInfo, ownerUri: string): Thenable<ListRegisteredServersResult> {
|
||||
@@ -98,4 +113,8 @@ export class CmsService {
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
dispose() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ export const isBigDataClusterProperty = 'isBigDataCluster';
|
||||
// SERVICE NAMES //////////////////////////////////////////////////////////
|
||||
export const ObjectExplorerService = 'objectexplorer';
|
||||
export const CmsService = 'cmsService';
|
||||
export const DacFxService = 'dacfxService';
|
||||
export const SchemaCompareService = 'schemaCompareService';
|
||||
export const objectExplorerPrefix: string = 'objectexplorer://';
|
||||
export const ViewType = 'view';
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { NotificationType, RequestType } from 'vscode-languageclient';
|
||||
import { ITelemetryEventProperties, ITelemetryEventMeasures } from './telemetry';
|
||||
import * as azdata from 'azdata';
|
||||
import { ConnectParams } from 'dataprotocol-client/lib/protocol';
|
||||
import { ListRegisteredServersResult } from './api/mssqlapis';
|
||||
import * as mssql from './mssql';
|
||||
|
||||
// ------------------------------- < Telemetry Sent Event > ------------------------------------
|
||||
|
||||
@@ -347,27 +347,27 @@ export interface GenerateDeployPlanParams {
|
||||
}
|
||||
|
||||
export namespace ExportRequest {
|
||||
export const type = new RequestType<ExportParams, azdata.DacFxResult, void, void>('dacfx/export');
|
||||
export const type = new RequestType<ExportParams, mssql.DacFxResult, void, void>('dacfx/export');
|
||||
}
|
||||
|
||||
export namespace ImportRequest {
|
||||
export const type = new RequestType<ImportParams, azdata.DacFxResult, void, void>('dacfx/import');
|
||||
export const type = new RequestType<ImportParams, mssql.DacFxResult, void, void>('dacfx/import');
|
||||
}
|
||||
|
||||
export namespace ExtractRequest {
|
||||
export const type = new RequestType<ExtractParams, azdata.DacFxResult, void, void>('dacfx/extract');
|
||||
export const type = new RequestType<ExtractParams, mssql.DacFxResult, void, void>('dacfx/extract');
|
||||
}
|
||||
|
||||
export namespace DeployRequest {
|
||||
export const type = new RequestType<DeployParams, azdata.DacFxResult, void, void>('dacfx/deploy');
|
||||
export const type = new RequestType<DeployParams, mssql.DacFxResult, void, void>('dacfx/deploy');
|
||||
}
|
||||
|
||||
export namespace GenerateDeployScriptRequest {
|
||||
export const type = new RequestType<GenerateDeployScriptParams, azdata.DacFxResult, void, void>('dacfx/generateDeploymentScript');
|
||||
export const type = new RequestType<GenerateDeployScriptParams, mssql.DacFxResult, void, void>('dacfx/generateDeploymentScript');
|
||||
}
|
||||
|
||||
export namespace GenerateDeployPlanRequest {
|
||||
export const type = new RequestType<GenerateDeployPlanParams, azdata.GenerateDeployPlanResult, void, void>('dacfx/generateDeployPlan');
|
||||
export const type = new RequestType<GenerateDeployPlanParams, mssql.GenerateDeployPlanResult, void, void>('dacfx/generateDeployPlan');
|
||||
}
|
||||
// ------------------------------- < DacFx > ------------------------------------
|
||||
|
||||
@@ -409,11 +409,11 @@ export interface RegisteredServerParamsBase {
|
||||
}
|
||||
|
||||
export namespace CreateCentralManagementServerRequest {
|
||||
export const type = new RequestType<CreateCentralManagementServerParams, ListRegisteredServersResult, void, void>('cms/createCms');
|
||||
export const type = new RequestType<CreateCentralManagementServerParams, mssql.ListRegisteredServersResult, void, void>('cms/createCms');
|
||||
}
|
||||
|
||||
export namespace ListRegisteredServersRequest {
|
||||
export const type = new RequestType<ListRegisteredServersParams, ListRegisteredServersResult, void, void>('cms/listRegisteredServers');
|
||||
export const type = new RequestType<ListRegisteredServersParams, mssql.ListRegisteredServersResult, void, void>('cms/listRegisteredServers');
|
||||
}
|
||||
|
||||
export namespace AddRegisteredServerRequest {
|
||||
@@ -436,10 +436,10 @@ export namespace RemoveServerGroupRequest {
|
||||
// ------------------------------- <Schema Compare> -----------------------------
|
||||
export interface SchemaCompareParams {
|
||||
operationId: string;
|
||||
sourceEndpointInfo: azdata.SchemaCompareEndpointInfo;
|
||||
targetEndpointInfo: azdata.SchemaCompareEndpointInfo;
|
||||
sourceEndpointInfo: mssql.SchemaCompareEndpointInfo;
|
||||
targetEndpointInfo: mssql.SchemaCompareEndpointInfo;
|
||||
taskExecutionMode: TaskExecutionMode;
|
||||
deploymentOptions: azdata.DeploymentOptions;
|
||||
deploymentOptions: mssql.DeploymentOptions;
|
||||
}
|
||||
|
||||
export interface SchemaCompareGenerateScriptParams {
|
||||
@@ -462,7 +462,7 @@ export interface SchemaCompareGetOptionsParams {
|
||||
|
||||
export interface SchemaCompareNodeParams {
|
||||
operationId: string;
|
||||
diffEntry: azdata.DiffEntry;
|
||||
diffEntry: mssql.DiffEntry;
|
||||
includeRequest: boolean;
|
||||
taskExecutionMode: TaskExecutionMode;
|
||||
}
|
||||
@@ -472,13 +472,13 @@ export interface SchemaCompareOpenScmpParams {
|
||||
}
|
||||
|
||||
export interface SchemaCompareSaveScmpParams {
|
||||
sourceEndpointInfo: azdata.SchemaCompareEndpointInfo;
|
||||
targetEndpointInfo: azdata.SchemaCompareEndpointInfo;
|
||||
sourceEndpointInfo: mssql.SchemaCompareEndpointInfo;
|
||||
targetEndpointInfo: mssql.SchemaCompareEndpointInfo;
|
||||
taskExecutionMode: TaskExecutionMode;
|
||||
deploymentOptions: azdata.DeploymentOptions;
|
||||
deploymentOptions: mssql.DeploymentOptions;
|
||||
scmpFilePath: string;
|
||||
excludedSourceObjects: azdata.SchemaCompareObjectId[];
|
||||
excludedTargetObjects: azdata.SchemaCompareObjectId[];
|
||||
excludedSourceObjects: mssql.SchemaCompareObjectId[];
|
||||
excludedTargetObjects: mssql.SchemaCompareObjectId[];
|
||||
}
|
||||
|
||||
export interface SchemaCompareCancelParams {
|
||||
@@ -486,7 +486,7 @@ export interface SchemaCompareCancelParams {
|
||||
}
|
||||
|
||||
export namespace SchemaCompareRequest {
|
||||
export const type = new RequestType<SchemaCompareParams, azdata.SchemaCompareResult, void, void>('schemaCompare/compare');
|
||||
export const type = new RequestType<SchemaCompareParams, mssql.SchemaCompareResult, void, void>('schemaCompare/compare');
|
||||
}
|
||||
|
||||
export namespace SchemaCompareGenerateScriptRequest {
|
||||
@@ -498,7 +498,7 @@ export namespace SchemaComparePublishChangesRequest {
|
||||
}
|
||||
|
||||
export namespace SchemaCompareGetDefaultOptionsRequest {
|
||||
export const type = new RequestType<SchemaCompareGetOptionsParams, azdata.SchemaCompareOptionsResult, void, void>('schemaCompare/getDefaultOptions');
|
||||
export const type = new RequestType<SchemaCompareGetOptionsParams, mssql.SchemaCompareOptionsResult, void, void>('schemaCompare/getDefaultOptions');
|
||||
}
|
||||
|
||||
export namespace SchemaCompareIncludeExcludeNodeRequest {
|
||||
|
||||
@@ -83,7 +83,7 @@ export class CredentialStore {
|
||||
providerId: Constants.providerId,
|
||||
features: [CredentialsFeature]
|
||||
};
|
||||
serverdownloader.getOrDownloadServer().then(e => {
|
||||
return serverdownloader.getOrDownloadServer().then(e => {
|
||||
let serverOptions = this.generateServerOptions(e);
|
||||
this._client = new SqlOpsDataClient(Constants.serviceName, serverOptions, clientOptions);
|
||||
this._client.start();
|
||||
|
||||
100
extensions/mssql/src/dacfx/dacFxService.ts
Normal file
100
extensions/mssql/src/dacfx/dacFxService.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as mssql from '../mssql';
|
||||
import { AppContext } from '../appContext';
|
||||
import { ISqlOpsFeature, SqlOpsDataClient } from 'dataprotocol-client';
|
||||
import { ClientCapabilities } from 'vscode-languageclient';
|
||||
import * as constants from '../constants';
|
||||
import * as Utils from '../utils';
|
||||
import * as azdata from 'azdata';
|
||||
import * as contracts from '../contracts';
|
||||
|
||||
export class DacFxService implements mssql.IDacFxService {
|
||||
public static asFeature(context: AppContext): ISqlOpsFeature {
|
||||
return class extends DacFxService {
|
||||
constructor(client: SqlOpsDataClient) {
|
||||
super(context, client);
|
||||
}
|
||||
|
||||
fillClientCapabilities(capabilities: ClientCapabilities): void {
|
||||
Utils.ensure(capabilities, 'dacfx')!.dacfx = true;
|
||||
}
|
||||
|
||||
initialize(): void {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private constructor(context: AppContext, protected readonly client: SqlOpsDataClient) {
|
||||
context.registerService(constants.DacFxService, this);
|
||||
}
|
||||
|
||||
public exportBacpac(databaseName: string, packageFilePath: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<mssql.DacFxResult> {
|
||||
const params: contracts.ExportParams = { databaseName: databaseName, packageFilePath: packageFilePath, ownerUri: ownerUri, taskExecutionMode: taskExecutionMode };
|
||||
return this.client.sendRequest(contracts.ExportRequest.type, params).then(
|
||||
undefined,
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.ExportRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public importBacpac(packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<mssql.DacFxResult> {
|
||||
const params: contracts.ImportParams = { packageFilePath: packageFilePath, databaseName: databaseName, ownerUri: ownerUri, taskExecutionMode: taskExecutionMode };
|
||||
return this.client.sendRequest(contracts.ImportRequest.type, params).then(
|
||||
undefined,
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.ImportRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public extractDacpac(databaseName: string, packageFilePath: string, applicationName: string, applicationVersion: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<mssql.DacFxResult> {
|
||||
const params: contracts.ExtractParams = { databaseName: databaseName, packageFilePath: packageFilePath, applicationName: applicationName, applicationVersion: applicationVersion, ownerUri: ownerUri, taskExecutionMode: taskExecutionMode };
|
||||
return this.client.sendRequest(contracts.ExtractRequest.type, params).then(
|
||||
undefined,
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.ExtractRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public deployDacpac(packageFilePath: string, targetDatabaseName: string, upgradeExisting: boolean, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<mssql.DacFxResult> {
|
||||
const params: contracts.DeployParams = { packageFilePath: packageFilePath, databaseName: targetDatabaseName, upgradeExisting: upgradeExisting, ownerUri: ownerUri, taskExecutionMode: taskExecutionMode };
|
||||
return this.client.sendRequest(contracts.DeployRequest.type, params).then(
|
||||
undefined,
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.DeployRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public generateDeployScript(packageFilePath: string, targetDatabaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<mssql.DacFxResult> {
|
||||
const params: contracts.GenerateDeployScriptParams = { packageFilePath: packageFilePath, databaseName: targetDatabaseName, ownerUri: ownerUri, taskExecutionMode: taskExecutionMode };
|
||||
return this.client.sendRequest(contracts.GenerateDeployScriptRequest.type, params).then(
|
||||
undefined,
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.GenerateDeployScriptRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public generateDeployPlan(packageFilePath: string, targetDatabaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<mssql.GenerateDeployPlanResult> {
|
||||
const params: contracts.GenerateDeployPlanParams = { packageFilePath: packageFilePath, databaseName: targetDatabaseName, ownerUri: ownerUri, taskExecutionMode: taskExecutionMode };
|
||||
return this.client.sendRequest(contracts.GenerateDeployPlanRequest.type, params).then(
|
||||
undefined,
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.GenerateDeployPlanRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -27,267 +27,6 @@ export class TelemetryFeature implements StaticFeature {
|
||||
}
|
||||
}
|
||||
|
||||
export class DacFxServicesFeature extends SqlOpsFeature<undefined> {
|
||||
private static readonly messageTypes: RPCMessageType[] = [
|
||||
contracts.ExportRequest.type,
|
||||
contracts.ImportRequest.type,
|
||||
contracts.ExtractRequest.type,
|
||||
contracts.DeployRequest.type
|
||||
];
|
||||
|
||||
constructor(client: SqlOpsDataClient) {
|
||||
super(client, DacFxServicesFeature.messageTypes);
|
||||
}
|
||||
|
||||
public fillClientCapabilities(capabilities: ClientCapabilities): void {
|
||||
}
|
||||
|
||||
public initialize(capabilities: ServerCapabilities): void {
|
||||
this.register(this.messages, {
|
||||
id: UUID.generateUuid(),
|
||||
registerOptions: undefined
|
||||
});
|
||||
}
|
||||
|
||||
protected registerProvider(options: undefined): Disposable {
|
||||
const client = this._client;
|
||||
|
||||
let exportBacpac = (databaseName: string, packageFilePath: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.DacFxResult> => {
|
||||
let params: contracts.ExportParams = { databaseName: databaseName, packageFilePath: packageFilePath, ownerUri: ownerUri, taskExecutionMode: taskExecutionMode };
|
||||
return client.sendRequest(contracts.ExportRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
},
|
||||
e => {
|
||||
client.logFailedRequest(contracts.ExportRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
let importBacpac = (packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.DacFxResult> => {
|
||||
let params: contracts.ImportParams = { packageFilePath: packageFilePath, databaseName: databaseName, ownerUri: ownerUri, taskExecutionMode: taskExecutionMode };
|
||||
return client.sendRequest(contracts.ImportRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
},
|
||||
e => {
|
||||
client.logFailedRequest(contracts.ImportRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
let extractDacpac = (databaseName: string, packageFilePath: string, applicationName: string, applicationVersion: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.DacFxResult> => {
|
||||
let params: contracts.ExtractParams = { databaseName: databaseName, packageFilePath: packageFilePath, applicationName: applicationName, applicationVersion: applicationVersion, ownerUri: ownerUri, taskExecutionMode: taskExecutionMode };
|
||||
return client.sendRequest(contracts.ExtractRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
},
|
||||
e => {
|
||||
client.logFailedRequest(contracts.ExtractRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
let deployDacpac = (packageFilePath: string, targetDatabaseName: string, upgradeExisting: boolean, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.DacFxResult> => {
|
||||
let params: contracts.DeployParams = { packageFilePath: packageFilePath, databaseName: targetDatabaseName, upgradeExisting: upgradeExisting, ownerUri: ownerUri, taskExecutionMode: taskExecutionMode };
|
||||
return client.sendRequest(contracts.DeployRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
},
|
||||
e => {
|
||||
client.logFailedRequest(contracts.DeployRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
let generateDeployScript = (packageFilePath: string, targetDatabaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.DacFxResult> => {
|
||||
let params: contracts.GenerateDeployScriptParams = { packageFilePath: packageFilePath, databaseName: targetDatabaseName, ownerUri: ownerUri, taskExecutionMode: taskExecutionMode };
|
||||
return client.sendRequest(contracts.GenerateDeployScriptRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
},
|
||||
e => {
|
||||
client.logFailedRequest(contracts.GenerateDeployScriptRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
let generateDeployPlan = (packageFilePath: string, targetDatabaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.GenerateDeployPlanResult> => {
|
||||
let params: contracts.GenerateDeployPlanParams = { packageFilePath: packageFilePath, databaseName: targetDatabaseName, ownerUri: ownerUri, taskExecutionMode: taskExecutionMode };
|
||||
return client.sendRequest(contracts.GenerateDeployPlanRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
},
|
||||
e => {
|
||||
client.logFailedRequest(contracts.GenerateDeployPlanRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
return azdata.dataprotocol.registerDacFxServicesProvider({
|
||||
providerId: client.providerId,
|
||||
exportBacpac,
|
||||
importBacpac,
|
||||
extractDacpac,
|
||||
deployDacpac,
|
||||
generateDeployScript,
|
||||
generateDeployPlan
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class SchemaCompareServicesFeature extends SqlOpsFeature<undefined> {
|
||||
private static readonly messageTypes: RPCMessageType[] = [
|
||||
contracts.SchemaCompareRequest.type,
|
||||
contracts.SchemaCompareGenerateScriptRequest.type,
|
||||
contracts.SchemaComparePublishChangesRequest.type,
|
||||
contracts.SchemaCompareGetDefaultOptionsRequest.type,
|
||||
contracts.SchemaCompareIncludeExcludeNodeRequest.type,
|
||||
contracts.SchemaCompareOpenScmpRequest.type,
|
||||
contracts.SchemaCompareSaveScmpRequest.type
|
||||
];
|
||||
|
||||
constructor(client: SqlOpsDataClient) {
|
||||
super(client, SchemaCompareServicesFeature.messageTypes);
|
||||
}
|
||||
|
||||
public fillClientCapabilities(capabilities: ClientCapabilities): void {
|
||||
}
|
||||
|
||||
public initialize(capabilities: ServerCapabilities): void {
|
||||
this.register(this.messages, {
|
||||
id: UUID.generateUuid(),
|
||||
registerOptions: undefined
|
||||
});
|
||||
}
|
||||
|
||||
protected registerProvider(options: undefined): Disposable {
|
||||
const client = this._client;
|
||||
|
||||
let schemaCompare = (operationId: string, sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, deploymentOptions: azdata.DeploymentOptions): Thenable<azdata.SchemaCompareResult> => {
|
||||
let params: contracts.SchemaCompareParams = { operationId: operationId, sourceEndpointInfo: sourceEndpointInfo, targetEndpointInfo: targetEndpointInfo, taskExecutionMode: taskExecutionMode, deploymentOptions: deploymentOptions };
|
||||
return client.sendRequest(contracts.SchemaCompareRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
},
|
||||
e => {
|
||||
client.logFailedRequest(contracts.SchemaCompareRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
let schemaCompareGenerateScript = (operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> => {
|
||||
let params: contracts.SchemaCompareGenerateScriptParams = { operationId: operationId, targetServerName: targetServerName, targetDatabaseName: targetDatabaseName, taskExecutionMode: taskExecutionMode };
|
||||
return client.sendRequest(contracts.SchemaCompareGenerateScriptRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
},
|
||||
e => {
|
||||
client.logFailedRequest(contracts.SchemaCompareGenerateScriptRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
let schemaComparePublishChanges = (operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> => {
|
||||
let params: contracts.SchemaComparePublishChangesParams = { operationId: operationId, targetServerName: targetServerName, targetDatabaseName: targetDatabaseName, taskExecutionMode: taskExecutionMode };
|
||||
return client.sendRequest(contracts.SchemaComparePublishChangesRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
},
|
||||
e => {
|
||||
client.logFailedRequest(contracts.SchemaComparePublishChangesRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
let schemaCompareGetDefaultOptions = (): Thenable<azdata.SchemaCompareOptionsResult> => {
|
||||
let params: contracts.SchemaCompareGetOptionsParams = {};
|
||||
return client.sendRequest(contracts.SchemaCompareGetDefaultOptionsRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
},
|
||||
e => {
|
||||
client.logFailedRequest(contracts.SchemaCompareGetDefaultOptionsRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
let schemaCompareIncludeExcludeNode = (operationId: string, diffEntry: azdata.DiffEntry, includeRequest: boolean, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> => {
|
||||
let params: contracts.SchemaCompareNodeParams = { operationId: operationId, diffEntry, includeRequest, taskExecutionMode: taskExecutionMode };
|
||||
return client.sendRequest(contracts.SchemaCompareIncludeExcludeNodeRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
},
|
||||
e => {
|
||||
client.logFailedRequest(contracts.SchemaCompareIncludeExcludeNodeRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
let schemaCompareOpenScmp = (filePath: string): Thenable<azdata.SchemaCompareOpenScmpResult> => {
|
||||
let params: contracts.SchemaCompareOpenScmpParams = { filePath: filePath };
|
||||
return client.sendRequest(contracts.SchemaCompareOpenScmpRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
},
|
||||
e => {
|
||||
client.logFailedRequest(contracts.SchemaCompareOpenScmpRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
let schemaCompareSaveScmp = (sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, deploymentOptions: azdata.DeploymentOptions, scmpFilePath: string, excludedSourceObjects: azdata.SchemaCompareObjectId[], excludedTargetObjects: azdata.SchemaCompareObjectId[]): Thenable<azdata.ResultStatus> => {
|
||||
let params: contracts.SchemaCompareSaveScmpParams = { sourceEndpointInfo: sourceEndpointInfo, targetEndpointInfo: targetEndpointInfo, taskExecutionMode: taskExecutionMode, deploymentOptions: deploymentOptions, scmpFilePath: scmpFilePath, excludedSourceObjects: excludedSourceObjects, excludedTargetObjects: excludedTargetObjects };
|
||||
return client.sendRequest(contracts.SchemaCompareSaveScmpRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
},
|
||||
e => {
|
||||
client.logFailedRequest(contracts.SchemaCompareSaveScmpRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
let schemaCompareCancel = (operationId: string): Thenable<azdata.ResultStatus> => {
|
||||
let params: contracts.SchemaCompareCancelParams = { operationId: operationId };
|
||||
return client.sendRequest(contracts.SchemaCompareCancellationRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
},
|
||||
e => {
|
||||
client.logFailedRequest(contracts.SchemaCompareCancellationRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
return azdata.dataprotocol.registerSchemaCompareServicesProvider({
|
||||
providerId: client.providerId,
|
||||
schemaCompare,
|
||||
schemaCompareGenerateScript,
|
||||
schemaComparePublishChanges,
|
||||
schemaCompareGetDefaultOptions,
|
||||
schemaCompareIncludeExcludeNode,
|
||||
schemaCompareOpenScmp,
|
||||
schemaCompareSaveScmp,
|
||||
schemaCompareCancel
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class AgentServicesFeature extends SqlOpsFeature<undefined> {
|
||||
private static readonly messagesTypes: RPCMessageType[] = [
|
||||
contracts.AgentJobsRequest.type,
|
||||
|
||||
8
extensions/mssql/src/localize.ts
Normal file
8
extensions/mssql/src/localize.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
export const localize = nls.loadMessageBundle();
|
||||
@@ -7,44 +7,32 @@ import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import * as path from 'path';
|
||||
import * as os from 'os';
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
import { SqlOpsDataClient, ClientOptions } from 'dataprotocol-client';
|
||||
import { IConfig, ServerProvider, Events } from 'service-downloader';
|
||||
import { ServerOptions, TransportKind } from 'vscode-languageclient';
|
||||
|
||||
import * as Constants from './constants';
|
||||
import ContextProvider from './contextProvider';
|
||||
import { CredentialStore } from './credentialstore/credentialstore';
|
||||
import { AzureResourceProvider } from './resourceProvider/resourceProvider';
|
||||
import * as Utils from './utils';
|
||||
import { Telemetry, LanguageClientErrorHandler } from './telemetry';
|
||||
import { TelemetryFeature, AgentServicesFeature, DacFxServicesFeature, SchemaCompareServicesFeature, SerializationFeature } from './features';
|
||||
import { AppContext } from './appContext';
|
||||
import { ApiWrapper } from './apiWrapper';
|
||||
import { UploadFilesCommand, MkDirCommand, SaveFileCommand, PreviewFileCommand, CopyPathCommand, DeleteFilesCommand } from './objectExplorerNodeProvider/hdfsCommands';
|
||||
import { IPrompter } from './prompts/question';
|
||||
import CodeAdapter from './prompts/adapter';
|
||||
import { MssqlExtensionApi, MssqlObjectExplorerBrowser } from './api/mssqlapis';
|
||||
import { mssql } from './mssql';
|
||||
import { OpenSparkJobSubmissionDialogCommand, OpenSparkJobSubmissionDialogFromFileCommand, OpenSparkJobSubmissionDialogTask } from './sparkFeature/dialog/dialogCommands';
|
||||
import { OpenSparkYarnHistoryTask } from './sparkFeature/historyTask';
|
||||
import { MssqlObjectExplorerNodeProvider, mssqlOutputChannel } from './objectExplorerNodeProvider/objectExplorerNodeProvider';
|
||||
import { CmsService } from './cms/cmsService';
|
||||
import { registerSearchServerCommand } from './objectExplorerNodeProvider/command';
|
||||
import { MssqlIconProvider } from './iconProvider';
|
||||
import { registerServiceEndpoints } from './dashboard/serviceEndpoints';
|
||||
import { getBookExtensionContributions } from './dashboard/bookExtensions';
|
||||
import { registerBooksWidget } from './dashboard/bookWidget';
|
||||
import { createMssqlApi } from './mssqlApiFactory';
|
||||
import { localize } from './localize';
|
||||
import { SqlToolsServer } from './sqlToolsServer';
|
||||
|
||||
const baseConfig = require('./config.json');
|
||||
const outputChannel = vscode.window.createOutputChannel(Constants.serviceName);
|
||||
const statusView = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
|
||||
const msgSampleCodeDataFrame = localize('msgSampleCodeDataFrame', 'This sample code loads the file into a data frame and shows the first 10 results.');
|
||||
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext): Promise<MssqlExtensionApi> {
|
||||
export async function activate(context: vscode.ExtensionContext): Promise<mssql> {
|
||||
// lets make sure we support this platform first
|
||||
let supported = await Utils.verifyPlatform();
|
||||
|
||||
@@ -53,74 +41,25 @@ export async function activate(context: vscode.ExtensionContext): Promise<MssqlE
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// ensure our log path exists
|
||||
if (!(await Utils.pfs.exists(context.logPath))) {
|
||||
await Utils.pfs.mkdir(context.logPath);
|
||||
}
|
||||
|
||||
let config: IConfig = JSON.parse(JSON.stringify(baseConfig));
|
||||
config.installDirectory = path.join(__dirname, config.installDirectory);
|
||||
config.proxy = vscode.workspace.getConfiguration('http').get('proxy');
|
||||
config.strictSSL = vscode.workspace.getConfiguration('http').get('proxyStrictSSL') || true;
|
||||
|
||||
const credentialsStore = new CredentialStore(context.logPath, config);
|
||||
const resourceProvider = new AzureResourceProvider(context.logPath, config);
|
||||
let languageClient: SqlOpsDataClient;
|
||||
let cmsService: CmsService;
|
||||
|
||||
const serverdownloader = new ServerProvider(config);
|
||||
|
||||
serverdownloader.eventEmitter.onAny(generateHandleServerProviderEvent());
|
||||
|
||||
let clientOptions: ClientOptions = getClientOptions();
|
||||
|
||||
let prompter: IPrompter = new CodeAdapter();
|
||||
let appContext = new AppContext(context, new ApiWrapper());
|
||||
|
||||
const installationStart = Date.now();
|
||||
let serverPromise = serverdownloader.getOrDownloadServer().then(e => {
|
||||
const installationComplete = Date.now();
|
||||
let serverOptions = generateServerOptions(context.logPath, e);
|
||||
languageClient = new SqlOpsDataClient(Constants.serviceName, serverOptions, clientOptions);
|
||||
const processStart = Date.now();
|
||||
languageClient.onReady().then(() => {
|
||||
const processEnd = Date.now();
|
||||
statusView.text = 'Service Started';
|
||||
setTimeout(() => {
|
||||
statusView.hide();
|
||||
}, 1500);
|
||||
Telemetry.sendTelemetryEvent('startup/LanguageClientStarted', {
|
||||
installationTime: String(installationComplete - installationStart),
|
||||
processStartupTime: String(processEnd - processStart),
|
||||
totalTime: String(processEnd - installationStart),
|
||||
beginningTimestamp: String(installationStart)
|
||||
});
|
||||
let nodeProvider = new MssqlObjectExplorerNodeProvider(prompter, appContext);
|
||||
azdata.dataprotocol.registerObjectExplorerNodeProvider(nodeProvider);
|
||||
let iconProvider = new MssqlIconProvider();
|
||||
azdata.dataprotocol.registerIconProvider(iconProvider);
|
||||
|
||||
});
|
||||
statusView.show();
|
||||
statusView.text = 'Starting service';
|
||||
languageClient.start();
|
||||
credentialsStore.start();
|
||||
resourceProvider.start();
|
||||
activateSparkFeatures(appContext);
|
||||
activateNotebookTask(appContext);
|
||||
|
||||
let nodeProvider = new MssqlObjectExplorerNodeProvider(prompter, appContext);
|
||||
azdata.dataprotocol.registerObjectExplorerNodeProvider(nodeProvider);
|
||||
let iconProvider = new MssqlIconProvider();
|
||||
azdata.dataprotocol.registerIconProvider(iconProvider);
|
||||
cmsService = new CmsService(appContext, languageClient);
|
||||
|
||||
activateSparkFeatures(appContext);
|
||||
activateNotebookTask(appContext);
|
||||
}, e => {
|
||||
Telemetry.sendTelemetryEvent('ServiceInitializingFailed');
|
||||
vscode.window.showErrorMessage('Failed to start Sql tools service');
|
||||
});
|
||||
registerSearchServerCommand(appContext);
|
||||
let contextProvider = new ContextProvider();
|
||||
context.subscriptions.push(contextProvider);
|
||||
context.subscriptions.push(credentialsStore);
|
||||
context.subscriptions.push(resourceProvider);
|
||||
context.subscriptions.push(new ContextProvider());
|
||||
registerHdfsCommands(context, prompter, appContext);
|
||||
context.subscriptions.push({ dispose: () => languageClient.stop() });
|
||||
|
||||
registerLogCommand(context);
|
||||
|
||||
@@ -131,20 +70,12 @@ export async function activate(context: vscode.ExtensionContext): Promise<MssqlE
|
||||
|
||||
registerBooksWidget(bookContributionProvider);
|
||||
|
||||
let api: MssqlExtensionApi = {
|
||||
getMssqlObjectExplorerBrowser(): MssqlObjectExplorerBrowser {
|
||||
return {
|
||||
getNode: (context: azdata.ObjectExplorerContext) => {
|
||||
let oeProvider = appContext.getService<MssqlObjectExplorerNodeProvider>(Constants.ObjectExplorerService);
|
||||
return <any>oeProvider.findSqlClusterNodeByContext(context);
|
||||
}
|
||||
};
|
||||
},
|
||||
getCmsServiceProvider(): Promise<CmsService> {
|
||||
return serverPromise.then(() => cmsService);
|
||||
}
|
||||
};
|
||||
return api;
|
||||
// initalize client last so we don't have features stuck behind it
|
||||
const server = new SqlToolsServer();
|
||||
context.subscriptions.push(server);
|
||||
await server.start(appContext);
|
||||
|
||||
return createMssqlApi(appContext);
|
||||
}
|
||||
|
||||
const logFiles = ['resourceprovider.log', 'sqltools.log', 'credentialstore.log'];
|
||||
@@ -160,27 +91,6 @@ function registerLogCommand(context: vscode.ExtensionContext) {
|
||||
}));
|
||||
}
|
||||
|
||||
function getClientOptions(): ClientOptions {
|
||||
return {
|
||||
documentSelector: ['sql'],
|
||||
synchronize: {
|
||||
configurationSection: Constants.extensionConfigSectionName
|
||||
},
|
||||
providerId: Constants.providerId,
|
||||
errorHandler: new LanguageClientErrorHandler(),
|
||||
features: [
|
||||
// we only want to add new features
|
||||
...SqlOpsDataClient.defaultFeatures,
|
||||
TelemetryFeature,
|
||||
AgentServicesFeature,
|
||||
DacFxServicesFeature,
|
||||
SchemaCompareServicesFeature,
|
||||
SerializationFeature
|
||||
],
|
||||
outputChannel: new CustomOutputChannel()
|
||||
};
|
||||
}
|
||||
|
||||
function registerHdfsCommands(context: vscode.ExtensionContext, prompter: IPrompter, appContext: AppContext) {
|
||||
context.subscriptions.push(new UploadFilesCommand(prompter, appContext));
|
||||
context.subscriptions.push(new MkDirCommand(prompter, appContext));
|
||||
@@ -306,66 +216,7 @@ async function handleOpenClusterStatusNotebookTask(profile: azdata.IConnectionPr
|
||||
});
|
||||
}
|
||||
}
|
||||
function generateServerOptions(logPath: string, executablePath: string): ServerOptions {
|
||||
let launchArgs = Utils.getCommonLaunchArgsAndCleanupOldLogFiles(logPath, 'sqltools.log', executablePath);
|
||||
return { command: executablePath, args: launchArgs, transport: TransportKind.stdio };
|
||||
}
|
||||
|
||||
function generateHandleServerProviderEvent() {
|
||||
let dots = 0;
|
||||
return (e: string, ...args: any[]) => {
|
||||
switch (e) {
|
||||
case Events.INSTALL_START:
|
||||
outputChannel.show(true);
|
||||
statusView.show();
|
||||
outputChannel.appendLine(localize('installingServiceChannelMsg', 'Installing {0} service to {1}', Constants.serviceName, args[0]));
|
||||
statusView.text = localize('installingServiceStatusMsg', 'Installing Service');
|
||||
break;
|
||||
case Events.INSTALL_END:
|
||||
outputChannel.appendLine(localize('installedServiceChannelMsg', 'Installed'));
|
||||
break;
|
||||
case Events.DOWNLOAD_START:
|
||||
outputChannel.appendLine(localize('downloadingServiceChannelMsg', 'Downloading {0}', args[0]));
|
||||
outputChannel.append(localize('downloadingServiceSizeChannelMsg', '({0} KB)', Math.ceil(args[1] / 1024).toLocaleString(vscode.env.language)));
|
||||
statusView.text = localize('downloadingServiceStatusMsg', 'Downloading Service');
|
||||
break;
|
||||
case Events.DOWNLOAD_PROGRESS:
|
||||
let newDots = Math.ceil(args[0] / 5);
|
||||
if (newDots > dots) {
|
||||
outputChannel.append('.'.repeat(newDots - dots));
|
||||
dots = newDots;
|
||||
}
|
||||
break;
|
||||
case Events.DOWNLOAD_END:
|
||||
outputChannel.appendLine(localize('downloadServiceDoneChannelMsg', 'Done!'));
|
||||
break;
|
||||
default:
|
||||
console.error(`Unknown event from Server Provider ${e}`);
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// this method is called when your extension is deactivated
|
||||
export function deactivate(): void {
|
||||
}
|
||||
|
||||
class CustomOutputChannel implements vscode.OutputChannel {
|
||||
name: string;
|
||||
append(value: string): void {
|
||||
console.log(value);
|
||||
}
|
||||
appendLine(value: string): void {
|
||||
console.log(value);
|
||||
}
|
||||
clear(): void {
|
||||
}
|
||||
show(preserveFocus?: boolean): void;
|
||||
show(column?: vscode.ViewColumn, preserveFocus?: boolean): void;
|
||||
show(column?: any, preserveFocus?: any) {
|
||||
}
|
||||
hide(): void {
|
||||
}
|
||||
dispose(): void {
|
||||
}
|
||||
}
|
||||
|
||||
433
extensions/mssql/src/mssql.d.ts
vendored
Normal file
433
extensions/mssql/src/mssql.d.ts
vendored
Normal file
@@ -0,0 +1,433 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
// This is the place for extensions to expose APIs.
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
/**
|
||||
* Covers defining what the mssql extension exports to other extensions
|
||||
*
|
||||
* IMPORTANT: THIS IS NOT A HARD DEFINITION unlike vscode; therefore no enums or classes should be defined here
|
||||
* (const enums get evaluated when typescript -> javascript so those are fine)
|
||||
*/
|
||||
|
||||
|
||||
export const enum extension {
|
||||
name = 'Microsoft.mssql'
|
||||
}
|
||||
|
||||
/**
|
||||
* The APIs provided by Mssql extension
|
||||
*/
|
||||
export interface mssql {
|
||||
/**
|
||||
* Gets the object explorer API that supports querying over the connections supported by this extension
|
||||
*
|
||||
*/
|
||||
getMssqlObjectExplorerBrowser(): MssqlObjectExplorerBrowser;
|
||||
|
||||
/**
|
||||
* Get the Cms Service APIs to communicate with CMS connections supported by this extension
|
||||
*
|
||||
*/
|
||||
readonly cmsService: ICmsService;
|
||||
|
||||
readonly schemaCompare: ISchemaCompareService;
|
||||
|
||||
readonly dacFx: IDacFxService;
|
||||
}
|
||||
|
||||
/**
|
||||
* A browser supporting actions over the object explorer connections provided by this extension.
|
||||
* Currently this is the
|
||||
*/
|
||||
export interface MssqlObjectExplorerBrowser {
|
||||
/**
|
||||
* Gets the matching node given a context object, e.g. one from a right-click on a node in Object Explorer
|
||||
*/
|
||||
getNode<T extends ITreeNode>(objectExplorerContext: azdata.ObjectExplorerContext): Thenable<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A tree node in the object explorer tree
|
||||
*/
|
||||
export interface ITreeNode {
|
||||
getNodeInfo(): azdata.NodeInfo;
|
||||
getChildren(refreshChildren: boolean): ITreeNode[] | Thenable<ITreeNode[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A HDFS file node. This is a leaf node in the object explorer tree, and its contents
|
||||
* can be queried
|
||||
*/
|
||||
export interface IFileNode extends ITreeNode {
|
||||
getFileContentsAsString(maxBytes?: number): Thenable<string>;
|
||||
}
|
||||
|
||||
//#region --- schema compare
|
||||
export interface SchemaCompareResult extends azdata.ResultStatus {
|
||||
operationId: string;
|
||||
areEqual: boolean;
|
||||
differences: DiffEntry[];
|
||||
}
|
||||
|
||||
export interface SchemaCompareCompletionResult extends azdata.ResultStatus {
|
||||
operationId: string;
|
||||
areEqual: boolean;
|
||||
differences: DiffEntry[];
|
||||
}
|
||||
|
||||
export interface DiffEntry {
|
||||
updateAction: SchemaUpdateAction;
|
||||
differenceType: SchemaDifferenceType;
|
||||
name: string;
|
||||
sourceValue: string[];
|
||||
targetValue: string[];
|
||||
parent: DiffEntry;
|
||||
children: DiffEntry[];
|
||||
sourceScript: string;
|
||||
targetScript: string;
|
||||
}
|
||||
|
||||
export const enum SchemaUpdateAction {
|
||||
Delete = 0,
|
||||
Change = 1,
|
||||
Add = 2
|
||||
}
|
||||
|
||||
export const enum SchemaDifferenceType {
|
||||
Object = 0,
|
||||
Property = 1
|
||||
}
|
||||
|
||||
export const enum SchemaCompareEndpointType {
|
||||
Database = 0,
|
||||
Dacpac = 1
|
||||
}
|
||||
|
||||
export interface SchemaCompareEndpointInfo {
|
||||
endpointType: SchemaCompareEndpointType;
|
||||
packageFilePath: string;
|
||||
serverDisplayName: string;
|
||||
serverName: string;
|
||||
databaseName: string;
|
||||
ownerUri: string;
|
||||
connectionDetails: azdata.ConnectionInfo;
|
||||
}
|
||||
|
||||
export interface SchemaCompareObjectId {
|
||||
nameParts: string[];
|
||||
sqlObjectType: string;
|
||||
}
|
||||
|
||||
export interface SchemaCompareOptionsResult extends azdata.ResultStatus {
|
||||
defaultDeploymentOptions: DeploymentOptions;
|
||||
}
|
||||
|
||||
export interface DeploymentOptions {
|
||||
ignoreTableOptions: boolean;
|
||||
ignoreSemicolonBetweenStatements: boolean;
|
||||
ignoreRouteLifetime: boolean;
|
||||
ignoreRoleMembership: boolean;
|
||||
ignoreQuotedIdentifiers: boolean;
|
||||
ignorePermissions: boolean;
|
||||
ignorePartitionSchemes: boolean;
|
||||
ignoreObjectPlacementOnPartitionScheme: boolean;
|
||||
ignoreNotForReplication: boolean;
|
||||
ignoreLoginSids: boolean;
|
||||
ignoreLockHintsOnIndexes: boolean;
|
||||
ignoreKeywordCasing: boolean;
|
||||
ignoreIndexPadding: boolean;
|
||||
ignoreIndexOptions: boolean;
|
||||
ignoreIncrement: boolean;
|
||||
ignoreIdentitySeed: boolean;
|
||||
ignoreUserSettingsObjects: boolean;
|
||||
ignoreFullTextCatalogFilePath: boolean;
|
||||
ignoreWhitespace: boolean;
|
||||
ignoreWithNocheckOnForeignKeys: boolean;
|
||||
verifyCollationCompatibility: boolean;
|
||||
unmodifiableObjectWarnings: boolean;
|
||||
treatVerificationErrorsAsWarnings: boolean;
|
||||
scriptRefreshModule: boolean;
|
||||
scriptNewConstraintValidation: boolean;
|
||||
scriptFileSize: boolean;
|
||||
scriptDeployStateChecks: boolean;
|
||||
scriptDatabaseOptions: boolean;
|
||||
scriptDatabaseCompatibility: boolean;
|
||||
scriptDatabaseCollation: boolean;
|
||||
runDeploymentPlanExecutors: boolean;
|
||||
registerDataTierApplication: boolean;
|
||||
populateFilesOnFileGroups: boolean;
|
||||
noAlterStatementsToChangeClrTypes: boolean;
|
||||
includeTransactionalScripts: boolean;
|
||||
includeCompositeObjects: boolean;
|
||||
allowUnsafeRowLevelSecurityDataMovement: boolean;
|
||||
ignoreWithNocheckOnCheckConstraints: boolean;
|
||||
ignoreFillFactor: boolean;
|
||||
ignoreFileSize: boolean;
|
||||
ignoreFilegroupPlacement: boolean;
|
||||
doNotAlterReplicatedObjects: boolean;
|
||||
doNotAlterChangeDataCaptureObjects: boolean;
|
||||
disableAndReenableDdlTriggers: boolean;
|
||||
deployDatabaseInSingleUserMode: boolean;
|
||||
createNewDatabase: boolean;
|
||||
compareUsingTargetCollation: boolean;
|
||||
commentOutSetVarDeclarations: boolean;
|
||||
blockWhenDriftDetected: boolean;
|
||||
blockOnPossibleDataLoss: boolean;
|
||||
backupDatabaseBeforeChanges: boolean;
|
||||
allowIncompatiblePlatform: boolean;
|
||||
allowDropBlockingAssemblies: boolean;
|
||||
dropConstraintsNotInSource: boolean;
|
||||
dropDmlTriggersNotInSource: boolean;
|
||||
dropExtendedPropertiesNotInSource: boolean;
|
||||
dropIndexesNotInSource: boolean;
|
||||
ignoreFileAndLogFilePath: boolean;
|
||||
ignoreExtendedProperties: boolean;
|
||||
ignoreDmlTriggerState: boolean;
|
||||
ignoreDmlTriggerOrder: boolean;
|
||||
ignoreDefaultSchema: boolean;
|
||||
ignoreDdlTriggerState: boolean;
|
||||
ignoreDdlTriggerOrder: boolean;
|
||||
ignoreCryptographicProviderFilePath: boolean;
|
||||
verifyDeployment: boolean;
|
||||
ignoreComments: boolean;
|
||||
ignoreColumnCollation: boolean;
|
||||
ignoreAuthorizer: boolean;
|
||||
ignoreAnsiNulls: boolean;
|
||||
generateSmartDefaults: boolean;
|
||||
dropStatisticsNotInSource: boolean;
|
||||
dropRoleMembersNotInSource: boolean;
|
||||
dropPermissionsNotInSource: boolean;
|
||||
dropObjectsNotInSource: boolean;
|
||||
ignoreColumnOrder: boolean;
|
||||
doNotDropObjectTypes: SchemaObjectType[];
|
||||
excludeObjectTypes: SchemaObjectType[];
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
export interface SchemaCompareObjectId {
|
||||
nameParts: string[];
|
||||
sqlObjectType: string;
|
||||
}
|
||||
|
||||
export interface ISchemaCompareService {
|
||||
|
||||
schemaCompare(operationId: string, sourceEndpointInfo: SchemaCompareEndpointInfo, targetEndpointInfo: SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, deploymentOptions: DeploymentOptions): Thenable<SchemaCompareResult>;
|
||||
schemaCompareGenerateScript(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus>;
|
||||
schemaComparePublishChanges(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus>;
|
||||
schemaCompareGetDefaultOptions(): Thenable<SchemaCompareOptionsResult>;
|
||||
schemaCompareIncludeExcludeNode(operationId: string, diffEntry: DiffEntry, IncludeRequest: boolean, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus>;
|
||||
schemaCompareOpenScmp(filePath: string): Thenable<SchemaCompareOpenScmpResult>;
|
||||
schemaCompareSaveScmp(sourceEndpointInfo: SchemaCompareEndpointInfo, targetEndpointInfo: SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, deploymentOptions: DeploymentOptions, scmpFilePath: string, excludedSourceObjects: SchemaCompareObjectId[], excludedTargetObjects: SchemaCompareObjectId[]): Thenable<azdata.ResultStatus>;
|
||||
schemaCompareCancel(operationId: string): Thenable<azdata.ResultStatus>;
|
||||
}
|
||||
|
||||
export interface SchemaCompareOpenScmpResult extends azdata.ResultStatus {
|
||||
sourceEndpointInfo: SchemaCompareEndpointInfo;
|
||||
targetEndpointInfo: SchemaCompareEndpointInfo;
|
||||
originalTargetName: string;
|
||||
originalConnectionString: string;
|
||||
deploymentOptions: DeploymentOptions;
|
||||
excludedSourceElements: SchemaCompareObjectId[];
|
||||
excludedTargetElements: SchemaCompareObjectId[];
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region --- dacfx
|
||||
export interface IDacFxService {
|
||||
exportBacpac(databaseName: string, packageFilePath: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<DacFxResult>;
|
||||
importBacpac(packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<DacFxResult>;
|
||||
extractDacpac(databaseName: string, packageFilePath: string, applicationName: string, applicationVersion: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<DacFxResult>;
|
||||
deployDacpac(packageFilePath: string, databaseName: string, upgradeExisting: boolean, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<DacFxResult>;
|
||||
generateDeployScript(packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<DacFxResult>;
|
||||
generateDeployPlan(packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<GenerateDeployPlanResult>;
|
||||
}
|
||||
|
||||
export interface DacFxResult extends azdata.ResultStatus {
|
||||
operationId: string;
|
||||
}
|
||||
|
||||
export interface GenerateDeployPlanResult extends DacFxResult {
|
||||
report: string;
|
||||
}
|
||||
|
||||
export interface ExportParams {
|
||||
databaseName: string;
|
||||
packageFilePath: string;
|
||||
ownerUri: string;
|
||||
taskExecutionMode: azdata.TaskExecutionMode;
|
||||
}
|
||||
|
||||
export interface ImportParams {
|
||||
packageFilePath: string;
|
||||
databaseName: string;
|
||||
ownerUri: string;
|
||||
taskExecutionMode: azdata.TaskExecutionMode;
|
||||
}
|
||||
|
||||
export interface ExtractParams {
|
||||
databaseName: string;
|
||||
packageFilePath: string;
|
||||
applicationName: string;
|
||||
applicationVersion: string;
|
||||
ownerUri: string;
|
||||
taskExecutionMode: azdata.TaskExecutionMode;
|
||||
}
|
||||
|
||||
export interface DeployParams {
|
||||
packageFilePath: string;
|
||||
databaseName: string;
|
||||
upgradeExisting: boolean;
|
||||
ownerUri: string;
|
||||
taskExecutionMode: azdata.TaskExecutionMode;
|
||||
}
|
||||
|
||||
export interface GenerateDeployScriptParams {
|
||||
packageFilePath: string;
|
||||
databaseName: string;
|
||||
ownerUri: string;
|
||||
taskExecutionMode: azdata.TaskExecutionMode;
|
||||
}
|
||||
|
||||
export interface GenerateDeployPlan {
|
||||
packageFilePath: string;
|
||||
databaseName: string;
|
||||
ownerUri: string;
|
||||
taskExecutionMode: azdata.TaskExecutionMode;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region --- cms
|
||||
/**
|
||||
*
|
||||
* Interface containing all CMS related operations
|
||||
*/
|
||||
export interface ICmsService {
|
||||
/**
|
||||
* Connects to or creates a Central management Server
|
||||
*/
|
||||
createCmsServer(name: string, description:string, connectiondetails: azdata.ConnectionInfo, ownerUri: string): Thenable<ListRegisteredServersResult>;
|
||||
|
||||
/**
|
||||
* gets all Registered Servers inside a CMS on a particular level
|
||||
*/
|
||||
getRegisteredServers(ownerUri: string, relativePath: string): Thenable<ListRegisteredServersResult>;
|
||||
|
||||
/**
|
||||
* Adds a Registered Server inside a CMS on a particular level
|
||||
*/
|
||||
addRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string, registeredServerDescription:string, connectionDetails:azdata.ConnectionInfo): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Removes a Registered Server inside a CMS on a particular level
|
||||
*/
|
||||
removeRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Adds a Server Group inside a CMS on a particular level
|
||||
*/
|
||||
addServerGroup (ownerUri: string, relativePath: string, groupName: string, groupDescription:string): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Removes a Server Group inside a CMS on a particular level
|
||||
*/
|
||||
removeServerGroup (ownerUri: string, relativePath: string, groupName: string): Thenable<boolean>;
|
||||
}
|
||||
/**
|
||||
* CMS Result interfaces as passed back to Extensions
|
||||
*/
|
||||
export interface RegisteredServerResult {
|
||||
name: string;
|
||||
serverName: string;
|
||||
description: string;
|
||||
connectionDetails: azdata.ConnectionInfo;
|
||||
relativePath: string;
|
||||
}
|
||||
|
||||
export interface RegisteredServerGroup {
|
||||
name: string;
|
||||
description: string;
|
||||
relativePath: string;
|
||||
}
|
||||
|
||||
export interface ListRegisteredServersResult {
|
||||
registeredServersList: Array<RegisteredServerResult>;
|
||||
registeredServerGroups: Array<RegisteredServerGroup>;
|
||||
}
|
||||
//#endregion
|
||||
32
extensions/mssql/src/mssqlApiFactory.ts
Normal file
32
extensions/mssql/src/mssqlApiFactory.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { AppContext } from './appContext';
|
||||
import { mssql, ICmsService, IDacFxService, ISchemaCompareService, MssqlObjectExplorerBrowser } from './mssql';
|
||||
import * as constants from './constants';
|
||||
import { MssqlObjectExplorerNodeProvider } from './objectExplorerNodeProvider/objectExplorerNodeProvider';
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
export function createMssqlApi(context: AppContext): mssql {
|
||||
return {
|
||||
get cmsService() {
|
||||
return context.getService<ICmsService>(constants.CmsService);
|
||||
},
|
||||
get dacFx() {
|
||||
return context.getService<IDacFxService>(constants.DacFxService);
|
||||
},
|
||||
get schemaCompare() {
|
||||
return context.getService<ISchemaCompareService>(constants.SchemaCompareService);
|
||||
},
|
||||
getMssqlObjectExplorerBrowser(): MssqlObjectExplorerBrowser {
|
||||
return {
|
||||
getNode: (explorerContext: azdata.ObjectExplorerContext) => {
|
||||
let oeProvider = context.getService<MssqlObjectExplorerNodeProvider>(constants.ObjectExplorerService);
|
||||
return <any>oeProvider.findSqlClusterNodeByContext(explorerContext);
|
||||
}
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -9,8 +9,6 @@ import { IQuestion, IPrompter, IPromptCallback } from './question';
|
||||
// Supports simple pattern for prompting for user input and acting on this
|
||||
export default class CodeAdapter implements IPrompter {
|
||||
|
||||
constructor() { }
|
||||
|
||||
// TODO define question interface
|
||||
private fixQuestion(question: any): any {
|
||||
if (question.type === 'checkbox' && Array.isArray(question.choices)) {
|
||||
|
||||
@@ -88,7 +88,7 @@ export class AzureResourceProvider {
|
||||
providerId: Constants.providerId,
|
||||
features: [FireWallFeature]
|
||||
};
|
||||
serverdownloader.getOrDownloadServer().then(e => {
|
||||
return serverdownloader.getOrDownloadServer().then(e => {
|
||||
let serverOptions = this.generateServerOptions(e);
|
||||
this._client = new SqlOpsDataClient(Constants.serviceName, serverOptions, clientOptions);
|
||||
this._client.start();
|
||||
|
||||
122
extensions/mssql/src/schemaCompare/schemaCompareService.ts
Normal file
122
extensions/mssql/src/schemaCompare/schemaCompareService.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { AppContext } from '../appContext';
|
||||
import { SqlOpsDataClient, ISqlOpsFeature } from 'dataprotocol-client';
|
||||
import * as constants from '../constants';
|
||||
import * as mssql from '../mssql';
|
||||
import * as Utils from '../utils';
|
||||
import { ClientCapabilities } from 'vscode-languageclient';
|
||||
import * as azdata from 'azdata';
|
||||
import * as contracts from '../contracts';
|
||||
|
||||
export class SchemaCompareService implements mssql.ISchemaCompareService {
|
||||
public static asFeature(context: AppContext): ISqlOpsFeature {
|
||||
return class extends SchemaCompareService {
|
||||
constructor(client: SqlOpsDataClient) {
|
||||
super(context, client);
|
||||
}
|
||||
|
||||
fillClientCapabilities(capabilities: ClientCapabilities): void {
|
||||
Utils.ensure(capabilities, 'schemaCompare')!.schemaCompare = true;
|
||||
}
|
||||
|
||||
initialize(): void {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private constructor(context: AppContext, protected readonly client: SqlOpsDataClient) {
|
||||
context.registerService(constants.SchemaCompareService, this);
|
||||
}
|
||||
|
||||
public schemaCompare(operationId: string, sourceEndpointInfo: mssql.SchemaCompareEndpointInfo, targetEndpointInfo: mssql.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, deploymentOptions: mssql.DeploymentOptions): Thenable<mssql.SchemaCompareResult> {
|
||||
const params: contracts.SchemaCompareParams = { operationId: operationId, sourceEndpointInfo: sourceEndpointInfo, targetEndpointInfo: targetEndpointInfo, taskExecutionMode: taskExecutionMode, deploymentOptions: deploymentOptions };
|
||||
return this.client.sendRequest(contracts.SchemaCompareRequest.type, params).then(
|
||||
undefined,
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.SchemaCompareRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public schemaCompareGenerateScript(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> {
|
||||
const params: contracts.SchemaCompareGenerateScriptParams = { operationId: operationId, targetServerName: targetServerName, targetDatabaseName: targetDatabaseName, taskExecutionMode: taskExecutionMode };
|
||||
return this.client.sendRequest(contracts.SchemaCompareGenerateScriptRequest.type, params).then(
|
||||
undefined,
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.SchemaCompareGenerateScriptRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public schemaComparePublishChanges(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> {
|
||||
const params: contracts.SchemaComparePublishChangesParams = { operationId: operationId, targetServerName: targetServerName, targetDatabaseName: targetDatabaseName, taskExecutionMode: taskExecutionMode };
|
||||
return this.client.sendRequest(contracts.SchemaComparePublishChangesRequest.type, params).then(
|
||||
undefined,
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.SchemaComparePublishChangesRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public schemaCompareGetDefaultOptions(): Thenable<mssql.SchemaCompareOptionsResult> {
|
||||
const params: contracts.SchemaCompareGetOptionsParams = {};
|
||||
return this.client.sendRequest(contracts.SchemaCompareGetDefaultOptionsRequest.type, params).then(
|
||||
undefined,
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.SchemaCompareGetDefaultOptionsRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public schemaCompareIncludeExcludeNode(operationId: string, diffEntry: mssql.DiffEntry, includeRequest: boolean, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> {
|
||||
const params: contracts.SchemaCompareNodeParams = { operationId: operationId, diffEntry, includeRequest, taskExecutionMode: taskExecutionMode };
|
||||
return this.client.sendRequest(contracts.SchemaCompareIncludeExcludeNodeRequest.type, params).then(
|
||||
undefined,
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.SchemaCompareIncludeExcludeNodeRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public schemaCompareOpenScmp(filePath: string): Thenable<mssql.SchemaCompareOpenScmpResult> {
|
||||
const params: contracts.SchemaCompareOpenScmpParams = { filePath: filePath };
|
||||
return this.client.sendRequest(contracts.SchemaCompareOpenScmpRequest.type, params).then(
|
||||
undefined,
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.SchemaCompareOpenScmpRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public schemaCompareSaveScmp(sourceEndpointInfo: mssql.SchemaCompareEndpointInfo, targetEndpointInfo: mssql.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, deploymentOptions: mssql.DeploymentOptions, scmpFilePath: string, excludedSourceObjects: mssql.SchemaCompareObjectId[], excludedTargetObjects: mssql.SchemaCompareObjectId[]): Thenable<azdata.ResultStatus> {
|
||||
const params: contracts.SchemaCompareSaveScmpParams = { sourceEndpointInfo: sourceEndpointInfo, targetEndpointInfo: targetEndpointInfo, taskExecutionMode: taskExecutionMode, deploymentOptions: deploymentOptions, scmpFilePath: scmpFilePath, excludedSourceObjects: excludedSourceObjects, excludedTargetObjects: excludedTargetObjects };
|
||||
return this.client.sendRequest(contracts.SchemaCompareSaveScmpRequest.type, params).then(
|
||||
undefined,
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.SchemaCompareSaveScmpRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public schemaCompareCancel(operationId: string): Thenable<azdata.ResultStatus> {
|
||||
const params: contracts.SchemaCompareCancelParams = { operationId: operationId };
|
||||
return this.client.sendRequest(contracts.SchemaCompareCancellationRequest.type, params).then(
|
||||
undefined,
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.SchemaCompareCancellationRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
175
extensions/mssql/src/sqlToolsServer.ts
Normal file
175
extensions/mssql/src/sqlToolsServer.ts
Normal file
@@ -0,0 +1,175 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ServerProvider, IConfig, Events } from 'service-downloader';
|
||||
import { ServerOptions, TransportKind } from 'vscode-languageclient';
|
||||
import * as Constants from './constants';
|
||||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import { getCommonLaunchArgsAndCleanupOldLogFiles } from './utils';
|
||||
import { localize } from './localize';
|
||||
import { Telemetry, LanguageClientErrorHandler } from './telemetry';
|
||||
import { SqlOpsDataClient, ClientOptions } from 'dataprotocol-client';
|
||||
import { TelemetryFeature, AgentServicesFeature, SerializationFeature } from './features';
|
||||
import { CredentialStore } from './credentialstore/credentialstore';
|
||||
import { AzureResourceProvider } from './resourceProvider/resourceProvider';
|
||||
import { SchemaCompareService } from './schemaCompare/schemaCompareService';
|
||||
import { AppContext } from './appContext';
|
||||
import { DacFxService } from './dacfx/dacFxService';
|
||||
import { CmsService } from './cms/cmsService';
|
||||
|
||||
const baseConfig = require('./config.json');
|
||||
|
||||
const outputChannel = vscode.window.createOutputChannel(Constants.serviceName);
|
||||
const statusView = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
|
||||
|
||||
export class SqlToolsServer {
|
||||
|
||||
private client: SqlOpsDataClient;
|
||||
private config: IConfig;
|
||||
private disposables = new Array<{ dispose: () => void }>();
|
||||
|
||||
public async start(context: AppContext): Promise<SqlOpsDataClient> {
|
||||
try {
|
||||
const installationStart = Date.now();
|
||||
const path = await this.download();
|
||||
const installationComplete = Date.now();
|
||||
let serverOptions = generateServerOptions(context.extensionContext.logPath, path);
|
||||
let clientOptions = getClientOptions(context);
|
||||
this.client = new SqlOpsDataClient(Constants.serviceName, serverOptions, clientOptions);
|
||||
const processStart = Date.now();
|
||||
this.client.onReady().then(() => {
|
||||
const processEnd = Date.now();
|
||||
statusView.text = 'Service Started';
|
||||
setTimeout(() => {
|
||||
statusView.hide();
|
||||
}, 1500);
|
||||
Telemetry.sendTelemetryEvent('startup/LanguageClientStarted', {
|
||||
installationTime: String(installationComplete - installationStart),
|
||||
processStartupTime: String(processEnd - processStart),
|
||||
totalTime: String(processEnd - installationStart),
|
||||
beginningTimestamp: String(installationStart)
|
||||
});
|
||||
});
|
||||
statusView.show();
|
||||
statusView.text = 'Starting service';
|
||||
this.client.start();
|
||||
await this.activateFeatures(context);
|
||||
return this.client;
|
||||
} catch (e) {
|
||||
Telemetry.sendTelemetryEvent('ServiceInitializingFailed');
|
||||
vscode.window.showErrorMessage('Failed to start Sql tools service');
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private download() {
|
||||
this.config = JSON.parse(JSON.stringify(baseConfig));
|
||||
this.config.installDirectory = path.join(__dirname, this.config.installDirectory);
|
||||
this.config.proxy = vscode.workspace.getConfiguration('http').get('proxy');
|
||||
this.config.strictSSL = vscode.workspace.getConfiguration('http').get('proxyStrictSSL') || true;
|
||||
|
||||
const serverdownloader = new ServerProvider(this.config);
|
||||
serverdownloader.eventEmitter.onAny(generateHandleServerProviderEvent());
|
||||
return serverdownloader.getOrDownloadServer();
|
||||
}
|
||||
|
||||
private activateFeatures(context: AppContext): Promise<void> {
|
||||
const credsStore = new CredentialStore(context.extensionContext.logPath, this.config);
|
||||
const resourceProvider = new AzureResourceProvider(context.extensionContext.logPath, this.config);
|
||||
this.disposables.push(credsStore);
|
||||
this.disposables.push(resourceProvider);
|
||||
return Promise.all([credsStore.start(), resourceProvider.start()]).then();
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this.disposables.forEach(d => d.dispose());
|
||||
if (this.client) {
|
||||
this.client.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function generateServerOptions(logPath: string, executablePath: string): ServerOptions {
|
||||
const launchArgs = getCommonLaunchArgsAndCleanupOldLogFiles(logPath, 'sqltools.log', executablePath);
|
||||
return { command: executablePath, args: launchArgs, transport: TransportKind.stdio };
|
||||
}
|
||||
|
||||
function generateHandleServerProviderEvent() {
|
||||
let dots = 0;
|
||||
return (e: string, ...args: any[]) => {
|
||||
switch (e) {
|
||||
case Events.INSTALL_START:
|
||||
outputChannel.show(true);
|
||||
statusView.show();
|
||||
outputChannel.appendLine(localize('installingServiceChannelMsg', 'Installing {0} service to {1}', Constants.serviceName, args[0]));
|
||||
statusView.text = localize('installingServiceStatusMsg', 'Installing Service');
|
||||
break;
|
||||
case Events.INSTALL_END:
|
||||
outputChannel.appendLine(localize('installedServiceChannelMsg', 'Installed'));
|
||||
break;
|
||||
case Events.DOWNLOAD_START:
|
||||
outputChannel.appendLine(localize('downloadingServiceChannelMsg', 'Downloading {0}', args[0]));
|
||||
outputChannel.append(localize('downloadingServiceSizeChannelMsg', '({0} KB)', Math.ceil(args[1] / 1024).toLocaleString(vscode.env.language)));
|
||||
statusView.text = localize('downloadingServiceStatusMsg', 'Downloading Service');
|
||||
break;
|
||||
case Events.DOWNLOAD_PROGRESS:
|
||||
let newDots = Math.ceil(args[0] / 5);
|
||||
if (newDots > dots) {
|
||||
outputChannel.append('.'.repeat(newDots - dots));
|
||||
dots = newDots;
|
||||
}
|
||||
break;
|
||||
case Events.DOWNLOAD_END:
|
||||
outputChannel.appendLine(localize('downloadServiceDoneChannelMsg', 'Done!'));
|
||||
break;
|
||||
default:
|
||||
console.error(`Unknown event from Server Provider ${e}`);
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function getClientOptions(context: AppContext): ClientOptions {
|
||||
return {
|
||||
documentSelector: ['sql'],
|
||||
synchronize: {
|
||||
configurationSection: Constants.extensionConfigSectionName
|
||||
},
|
||||
providerId: Constants.providerId,
|
||||
errorHandler: new LanguageClientErrorHandler(),
|
||||
features: [
|
||||
// we only want to add new features
|
||||
...SqlOpsDataClient.defaultFeatures,
|
||||
TelemetryFeature,
|
||||
AgentServicesFeature,
|
||||
SerializationFeature,
|
||||
SchemaCompareService.asFeature(context),
|
||||
DacFxService.asFeature(context),
|
||||
CmsService.asFeature(context)
|
||||
],
|
||||
outputChannel: new CustomOutputChannel()
|
||||
};
|
||||
}
|
||||
|
||||
class CustomOutputChannel implements vscode.OutputChannel {
|
||||
name: string;
|
||||
append(value: string): void {
|
||||
console.log(value);
|
||||
}
|
||||
appendLine(value: string): void {
|
||||
console.log(value);
|
||||
}
|
||||
clear(): void {
|
||||
}
|
||||
show(preserveFocus?: boolean): void;
|
||||
show(column?: vscode.ViewColumn, preserveFocus?: boolean): void;
|
||||
show(column?: any, preserveFocus?: any) {
|
||||
}
|
||||
hide(): void {
|
||||
}
|
||||
dispose(): void {
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import { isNullOrUndefined } from 'util';
|
||||
import { existsSync } from 'fs';
|
||||
import { Telemetry } from '../telemetry';
|
||||
import { getEndpointName } from '../utils';
|
||||
import * as mssql from '../../../mssql';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
const OkButtonText: string = localize('schemaCompareDialog.ok', 'OK');
|
||||
@@ -60,8 +61,8 @@ export class SchemaCompareDialog {
|
||||
private connectionId: string;
|
||||
private sourceDbEditable: string;
|
||||
private taregtDbEditable: string;
|
||||
private previousSource: azdata.SchemaCompareEndpointInfo;
|
||||
private previousTarget: azdata.SchemaCompareEndpointInfo;
|
||||
private previousSource: mssql.SchemaCompareEndpointInfo;
|
||||
private previousTarget: mssql.SchemaCompareEndpointInfo;
|
||||
|
||||
constructor(private schemaCompareResult: SchemaCompareMainWindow) {
|
||||
this.previousSource = schemaCompareResult.sourceEndpointInfo;
|
||||
@@ -97,7 +98,7 @@ export class SchemaCompareDialog {
|
||||
protected async execute(): Promise<void> {
|
||||
if (this.sourceIsDacpac) {
|
||||
this.schemaCompareResult.sourceEndpointInfo = {
|
||||
endpointType: azdata.SchemaCompareEndpointType.Dacpac,
|
||||
endpointType: mssql.SchemaCompareEndpointType.Dacpac,
|
||||
serverDisplayName: '',
|
||||
serverName: '',
|
||||
databaseName: '',
|
||||
@@ -109,7 +110,7 @@ export class SchemaCompareDialog {
|
||||
let ownerUri = await azdata.connection.getUriForConnection((this.sourceServerDropdown.value as ConnectionDropdownValue).connection.connectionId);
|
||||
|
||||
this.schemaCompareResult.sourceEndpointInfo = {
|
||||
endpointType: azdata.SchemaCompareEndpointType.Database,
|
||||
endpointType: mssql.SchemaCompareEndpointType.Database,
|
||||
serverDisplayName: (this.sourceServerDropdown.value as ConnectionDropdownValue).displayName,
|
||||
serverName: (this.sourceServerDropdown.value as ConnectionDropdownValue).name,
|
||||
databaseName: (<azdata.CategoryValue>this.sourceDatabaseDropdown.value).name,
|
||||
@@ -121,7 +122,7 @@ export class SchemaCompareDialog {
|
||||
|
||||
if (this.targetIsDacpac) {
|
||||
this.schemaCompareResult.targetEndpointInfo = {
|
||||
endpointType: azdata.SchemaCompareEndpointType.Dacpac,
|
||||
endpointType: mssql.SchemaCompareEndpointType.Dacpac,
|
||||
serverDisplayName: '',
|
||||
serverName: '',
|
||||
databaseName: '',
|
||||
@@ -133,7 +134,7 @@ export class SchemaCompareDialog {
|
||||
let ownerUri = await azdata.connection.getUriForConnection((this.targetServerDropdown.value as ConnectionDropdownValue).connection.connectionId);
|
||||
|
||||
this.schemaCompareResult.targetEndpointInfo = {
|
||||
endpointType: azdata.SchemaCompareEndpointType.Database,
|
||||
endpointType: mssql.SchemaCompareEndpointType.Database,
|
||||
serverDisplayName: (this.targetServerDropdown.value as ConnectionDropdownValue).displayName,
|
||||
serverName: (this.targetServerDropdown.value as ConnectionDropdownValue).name,
|
||||
databaseName: (<azdata.CategoryValue>this.targetDatabaseDropdown.value).name,
|
||||
@@ -174,7 +175,7 @@ export class SchemaCompareDialog {
|
||||
}
|
||||
}
|
||||
|
||||
private endpointChanged(previousEndpoint: azdata.SchemaCompareEndpointInfo, updatedEndpoint: azdata.SchemaCompareEndpointInfo): boolean {
|
||||
private endpointChanged(previousEndpoint: mssql.SchemaCompareEndpointInfo, updatedEndpoint: mssql.SchemaCompareEndpointInfo): boolean {
|
||||
if (previousEndpoint && updatedEndpoint) {
|
||||
return getEndpointName(previousEndpoint).toLowerCase() !== getEndpointName(updatedEndpoint).toLowerCase()
|
||||
|| (previousEndpoint.serverDisplayName && updatedEndpoint.serverDisplayName && previousEndpoint.serverDisplayName.toLowerCase() !== updatedEndpoint.serverDisplayName.toLowerCase());
|
||||
@@ -234,7 +235,7 @@ export class SchemaCompareDialog {
|
||||
let targetComponents = [];
|
||||
|
||||
// start source and target with either dacpac or database selection based on what the previous value was
|
||||
if (this.schemaCompareResult.sourceEndpointInfo && this.schemaCompareResult.sourceEndpointInfo.endpointType === azdata.SchemaCompareEndpointType.Database) {
|
||||
if (this.schemaCompareResult.sourceEndpointInfo && this.schemaCompareResult.sourceEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Database) {
|
||||
sourceComponents = [
|
||||
sourceRadioButtons,
|
||||
this.sourceServerComponent,
|
||||
@@ -247,7 +248,7 @@ export class SchemaCompareDialog {
|
||||
];
|
||||
}
|
||||
|
||||
if (this.schemaCompareResult.targetEndpointInfo && this.schemaCompareResult.targetEndpointInfo.endpointType === azdata.SchemaCompareEndpointType.Database) {
|
||||
if (this.schemaCompareResult.targetEndpointInfo && this.schemaCompareResult.targetEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Database) {
|
||||
targetComponents = [
|
||||
targetRadioButtons,
|
||||
this.targetServerComponent,
|
||||
@@ -283,7 +284,7 @@ export class SchemaCompareDialog {
|
||||
});
|
||||
}
|
||||
|
||||
private async createFileBrowser(view: azdata.ModelView, isTarget: boolean, endpoint: azdata.SchemaCompareEndpointInfo): Promise<azdata.FormComponent> {
|
||||
private async createFileBrowser(view: azdata.ModelView, isTarget: boolean, endpoint: mssql.SchemaCompareEndpointInfo): Promise<azdata.FormComponent> {
|
||||
let currentTextbox = isTarget ? this.targetTextBox : this.sourceTextBox;
|
||||
if (isTarget) {
|
||||
this.targetFileButton = view.modelBuilder.button().withProperties({
|
||||
@@ -367,7 +368,7 @@ export class SchemaCompareDialog {
|
||||
});
|
||||
|
||||
// if source is currently a db, show it in the server and db dropdowns
|
||||
if (this.schemaCompareResult.sourceEndpointInfo && this.schemaCompareResult.sourceEndpointInfo.endpointType === azdata.SchemaCompareEndpointType.Database) {
|
||||
if (this.schemaCompareResult.sourceEndpointInfo && this.schemaCompareResult.sourceEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Database) {
|
||||
databaseRadioButton.checked = true;
|
||||
this.sourceIsDacpac = false;
|
||||
} else {
|
||||
@@ -422,7 +423,7 @@ export class SchemaCompareDialog {
|
||||
});
|
||||
|
||||
// if target is currently a db, show it in the server and db dropdowns
|
||||
if (this.schemaCompareResult.targetEndpointInfo && this.schemaCompareResult.targetEndpointInfo.endpointType === azdata.SchemaCompareEndpointType.Database) {
|
||||
if (this.schemaCompareResult.targetEndpointInfo && this.schemaCompareResult.targetEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Database) {
|
||||
databaseRadioButton.checked = true;
|
||||
this.targetIsDacpac = false;
|
||||
} else {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import * as nls from 'vscode-nls';
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import * as mssql from '../../../mssql';
|
||||
import { SchemaCompareMainWindow } from '../schemaCompareMainWindow';
|
||||
import { isNullOrUndefined } from 'util';
|
||||
|
||||
@@ -246,7 +247,7 @@ export class SchemaCompareOptionsDialog {
|
||||
private static readonly descriptionIgnoreColumnOrder: string = localize('SchemaCompare.Description.IgnoreColumnOrder', 'Specifies whether differences in table column order should be ignored or updated when you publish to a database.');
|
||||
|
||||
public dialog: azdata.window.Dialog;
|
||||
public deploymentOptions: azdata.DeploymentOptions;
|
||||
public deploymentOptions: mssql.DeploymentOptions;
|
||||
|
||||
private generalOptionsTab: azdata.window.DialogTab;
|
||||
private objectTypesTab: azdata.window.DialogTab;
|
||||
@@ -261,7 +262,7 @@ export class SchemaCompareOptionsDialog {
|
||||
private objectsLookup = {};
|
||||
private disposableListeners: vscode.Disposable[] = [];
|
||||
|
||||
private excludedObjectTypes: azdata.SchemaObjectType[] = [];
|
||||
private excludedObjectTypes: mssql.SchemaObjectType[] = [];
|
||||
private optionsChanged: boolean = false;
|
||||
|
||||
private optionsLabels: string[] = [
|
||||
@@ -413,7 +414,7 @@ export class SchemaCompareOptionsDialog {
|
||||
SchemaCompareOptionsDialog.ServerTriggers
|
||||
].sort();
|
||||
|
||||
constructor(defaultOptions: azdata.DeploymentOptions, private schemaComparison: SchemaCompareMainWindow) {
|
||||
constructor(defaultOptions: mssql.DeploymentOptions, private schemaComparison: SchemaCompareMainWindow) {
|
||||
this.deploymentOptions = defaultOptions;
|
||||
}
|
||||
|
||||
@@ -465,7 +466,7 @@ export class SchemaCompareOptionsDialog {
|
||||
}
|
||||
|
||||
private async reset() {
|
||||
let service = await azdata.dataprotocol.getProvider<azdata.SchemaCompareServicesProvider>('MSSQL', azdata.DataProviderType.SchemaCompareServicesProvider);
|
||||
let service = (vscode.extensions.getExtension(mssql.extension.name).exports as mssql.mssql).schemaCompare;
|
||||
let result = await service.schemaCompareGetDefaultOptions();
|
||||
this.deploymentOptions = result.defaultDeploymentOptions;
|
||||
this.optionsChanged = true;
|
||||
@@ -1111,139 +1112,139 @@ export class SchemaCompareOptionsDialog {
|
||||
private GetSchemaCompareIncludedObjectsUtil(label): boolean {
|
||||
switch (label) {
|
||||
case SchemaCompareOptionsDialog.Aggregates:
|
||||
return !isNullOrUndefined(this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Aggregates)) ? false : true;
|
||||
return !isNullOrUndefined(this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Aggregates)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.ApplicationRoles:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.ApplicationRoles)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.ApplicationRoles)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Assemblies:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Assemblies)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Assemblies)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.AssemblyFiles:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.AssemblyFiles)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.AssemblyFiles)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.AsymmetricKeys:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.AsymmetricKeys)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.AsymmetricKeys)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.BrokerPriorities:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.BrokerPriorities)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.BrokerPriorities)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Certificates:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Certificates)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Certificates)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.ColumnEncryptionKeys:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.ColumnEncryptionKeys)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.ColumnEncryptionKeys)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.ColumnMasterKeys:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.ColumnMasterKeys)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.ColumnMasterKeys)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Contracts:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Contracts)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Contracts)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.DatabaseOptions:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.DatabaseOptions)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.DatabaseOptions)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.DatabaseRoles:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.DatabaseRoles)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.DatabaseRoles)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.DatabaseTriggers:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.DatabaseTriggers)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.DatabaseTriggers)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Defaults:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Defaults)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Defaults)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.ExtendedProperties:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.ExtendedProperties)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.ExtendedProperties)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.ExternalDataSources:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.ExternalDataSources)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.ExternalDataSources)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.ExternalFileFormats:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.ExternalFileFormats)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.ExternalFileFormats)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.ExternalTables:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.ExternalTables)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.ExternalTables)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Filegroups:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Filegroups)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Filegroups)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Files:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Files)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Files)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.FileTables:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.FileTables)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.FileTables)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.FullTextCatalogs:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.FullTextCatalogs)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.FullTextCatalogs)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.FullTextStoplists:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.FullTextStoplists)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.FullTextStoplists)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.MessageTypes:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.MessageTypes)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.MessageTypes)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.PartitionFunctions:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.PartitionFunctions)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.PartitionFunctions)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.PartitionSchemes:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.PartitionSchemes)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.PartitionSchemes)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Permissions:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Permissions)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Permissions)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Queues:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Queues)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Queues)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.RemoteServiceBindings:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.RemoteServiceBindings)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.RemoteServiceBindings)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.RoleMembership:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.RoleMembership)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.RoleMembership)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Rules:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Rules)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Rules)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.ScalarValuedFunctions:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.ScalarValuedFunctions)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.ScalarValuedFunctions)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.SearchPropertyLists:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.SearchPropertyLists)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.SearchPropertyLists)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.SecurityPolicies:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.SecurityPolicies)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.SecurityPolicies)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Sequences:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Sequences)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Sequences)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Services:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Services)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Services)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Signatures:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Signatures)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Signatures)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.StoredProcedures:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.StoredProcedures)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.StoredProcedures)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.SymmetricKeys:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.SymmetricKeys)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.SymmetricKeys)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Synonyms:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Synonyms)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Synonyms)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Tables:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Tables)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Tables)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.TableValuedFunctions:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.TableValuedFunctions)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.TableValuedFunctions)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.UserDefinedDataTypes:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.UserDefinedDataTypes)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.UserDefinedDataTypes)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.UserDefinedTableTypes:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.UserDefinedTableTypes)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.UserDefinedTableTypes)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.ClrUserDefinedTypes:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.ClrUserDefinedTypes)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.ClrUserDefinedTypes)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Users:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Users)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Users)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Views:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Views)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Views)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.XmlSchemaCollections:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.XmlSchemaCollections)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.XmlSchemaCollections)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Audits:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Audits)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Audits)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Credentials:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Credentials)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Credentials)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.CryptographicProviders:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.CryptographicProviders)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.CryptographicProviders)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.DatabaseAuditSpecifications:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.DatabaseAuditSpecifications)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.DatabaseAuditSpecifications)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.DatabaseEncryptionKeys:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.DatabaseEncryptionKeys)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.DatabaseEncryptionKeys)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.DatabaseScopedCredentials:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.DatabaseScopedCredentials)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.DatabaseScopedCredentials)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Endpoints:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Endpoints)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Endpoints)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.ErrorMessages:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.ErrorMessages)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.ErrorMessages)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.EventNotifications:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.EventNotifications)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.EventNotifications)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.EventSessions:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.EventSessions)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.EventSessions)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.LinkedServerLogins:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.LinkedServerLogins)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.LinkedServerLogins)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.LinkedServers:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.LinkedServers)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.LinkedServers)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Logins:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Logins)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Logins)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.MasterKeys:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.MasterKeys)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.MasterKeys)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.Routes:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.Routes)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.Routes)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.ServerAuditSpecifications:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.ServerAuditSpecifications)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.ServerAuditSpecifications)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.ServerRoleMembership:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.ServerRoleMembership)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.ServerRoleMembership)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.ServerRoles:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.ServerRoles)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.ServerRoles)) ? false : true;
|
||||
case SchemaCompareOptionsDialog.ServerTriggers:
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === azdata.SchemaObjectType.ServerTriggers)) ? false : true;
|
||||
return (this.deploymentOptions.excludeObjectTypes.find(x => x === mssql.SchemaObjectType.ServerTriggers)) ? false : true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1252,337 +1253,337 @@ export class SchemaCompareOptionsDialog {
|
||||
switch (label) {
|
||||
case SchemaCompareOptionsDialog.Aggregates:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Aggregates);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Aggregates);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.ApplicationRoles:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.ApplicationRoles);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ApplicationRoles);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Assemblies:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Assemblies);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Assemblies);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.AssemblyFiles:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.AssemblyFiles);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.AssemblyFiles);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.AsymmetricKeys:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.AsymmetricKeys);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.AsymmetricKeys);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.BrokerPriorities:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.BrokerPriorities);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.BrokerPriorities);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Certificates:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Certificates);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Certificates);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.ColumnEncryptionKeys:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.ColumnEncryptionKeys);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ColumnEncryptionKeys);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.ColumnMasterKeys:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.ColumnMasterKeys);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ColumnMasterKeys);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Contracts:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Contracts);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Contracts);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.DatabaseOptions:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.DatabaseOptions);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.DatabaseOptions);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.DatabaseRoles:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.DatabaseRoles);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.DatabaseRoles);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.DatabaseTriggers:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.DatabaseTriggers);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.DatabaseTriggers);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Defaults:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Defaults);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Defaults);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.ExtendedProperties:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.ExtendedProperties);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ExtendedProperties);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.ExternalDataSources:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.ExternalDataSources);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ExternalDataSources);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.ExternalFileFormats:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.ExternalFileFormats);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ExternalFileFormats);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.ExternalTables:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.ExternalTables);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ExternalTables);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Filegroups:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Filegroups);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Filegroups);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Files:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Files);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Files);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.FileTables:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.FileTables);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.FileTables);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.FullTextCatalogs:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.FullTextCatalogs);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.FullTextCatalogs);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.FullTextStoplists:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.FullTextStoplists);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.FullTextStoplists);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.MessageTypes:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.MessageTypes);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.MessageTypes);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.PartitionFunctions:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.PartitionFunctions);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.PartitionFunctions);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.PartitionSchemes:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.PartitionSchemes);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.PartitionSchemes);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Permissions:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Permissions);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Permissions);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Queues:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Queues);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Queues);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.RemoteServiceBindings:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.RemoteServiceBindings);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.RemoteServiceBindings);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.RoleMembership:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.RoleMembership);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.RoleMembership);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Rules:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Rules);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Rules);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.ScalarValuedFunctions:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.ScalarValuedFunctions);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ScalarValuedFunctions);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.SearchPropertyLists:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.SearchPropertyLists);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.SearchPropertyLists);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.SecurityPolicies:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.SecurityPolicies);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.SecurityPolicies);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Sequences:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Sequences);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Sequences);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Services:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Services);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Services);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Signatures:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Signatures);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Signatures);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.StoredProcedures:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.StoredProcedures);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.StoredProcedures);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.SymmetricKeys:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.SymmetricKeys);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.SymmetricKeys);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Synonyms:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Synonyms);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Synonyms);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Tables:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Tables);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Tables);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.TableValuedFunctions:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.TableValuedFunctions);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.TableValuedFunctions);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.UserDefinedDataTypes:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.UserDefinedDataTypes);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.UserDefinedDataTypes);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.UserDefinedTableTypes:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.UserDefinedTableTypes);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.UserDefinedTableTypes);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.ClrUserDefinedTypes:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.ClrUserDefinedTypes);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ClrUserDefinedTypes);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Users:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Users);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Users);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Views:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Views);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Views);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.XmlSchemaCollections:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.XmlSchemaCollections);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.XmlSchemaCollections);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Audits:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Audits);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Audits);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Credentials:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Credentials);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Credentials);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.CryptographicProviders:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.CryptographicProviders);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.CryptographicProviders);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.DatabaseAuditSpecifications:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.DatabaseAuditSpecifications);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.DatabaseAuditSpecifications);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.DatabaseEncryptionKeys:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.DatabaseEncryptionKeys);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.DatabaseEncryptionKeys);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.DatabaseScopedCredentials:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.DatabaseScopedCredentials);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.DatabaseScopedCredentials);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Endpoints:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Endpoints);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Endpoints);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.ErrorMessages:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.ErrorMessages);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ErrorMessages);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.EventNotifications:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.EventNotifications);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.EventNotifications);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.EventSessions:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.EventSessions);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.EventSessions);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.LinkedServerLogins:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.LinkedServerLogins);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.LinkedServerLogins);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.LinkedServers:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.LinkedServers);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.LinkedServers);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Logins:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Logins);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Logins);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.MasterKeys:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.MasterKeys);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.MasterKeys);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.Routes:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.Routes);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.Routes);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.ServerAuditSpecifications:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.ServerAuditSpecifications);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ServerAuditSpecifications);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.ServerRoleMembership:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.ServerRoleMembership);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ServerRoleMembership);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.ServerRoles:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.ServerRoles);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ServerRoles);
|
||||
}
|
||||
return;
|
||||
case SchemaCompareOptionsDialog.ServerTriggers:
|
||||
if (!included) {
|
||||
this.excludedObjectTypes.push(azdata.SchemaObjectType.ServerTriggers);
|
||||
this.excludedObjectTypes.push(mssql.SchemaObjectType.ServerTriggers);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as mssql from '../../mssql';
|
||||
import { SchemaCompareOptionsDialog } from './dialogs/schemaCompareOptionsDialog';
|
||||
import { Telemetry } from './telemetry';
|
||||
import { getTelemetryErrorType, getEndpointName, verifyConnectionAndGetOwnerUri } from './utils';
|
||||
@@ -56,28 +57,28 @@ export class SchemaCompareMainWindow {
|
||||
private saveScmpButton: azdata.ButtonComponent;
|
||||
private SchemaCompareActionMap: Map<Number, string>;
|
||||
private operationId: string;
|
||||
private comparisonResult: azdata.SchemaCompareResult;
|
||||
private comparisonResult: mssql.SchemaCompareResult;
|
||||
private sourceNameComponent: azdata.TableComponent;
|
||||
private targetNameComponent: azdata.TableComponent;
|
||||
private deploymentOptions: azdata.DeploymentOptions;
|
||||
private deploymentOptions: mssql.DeploymentOptions;
|
||||
private schemaCompareOptionDialog: SchemaCompareOptionsDialog;
|
||||
private tablelistenersToDispose: vscode.Disposable[] = [];
|
||||
private originalSourceExcludes = new Map<string, azdata.DiffEntry>();
|
||||
private originalTargetExcludes = new Map<string, azdata.DiffEntry>();
|
||||
private originalSourceExcludes = new Map<string, mssql.DiffEntry>();
|
||||
private originalTargetExcludes = new Map<string, mssql.DiffEntry>();
|
||||
private sourceTargetSwitched = false;
|
||||
private sourceName: string;
|
||||
private targetName: string;
|
||||
private scmpSourceExcludes: azdata.SchemaCompareObjectId[];
|
||||
private scmpTargetExcludes: azdata.SchemaCompareObjectId[];
|
||||
private scmpSourceExcludes: mssql.SchemaCompareObjectId[];
|
||||
private scmpTargetExcludes: mssql.SchemaCompareObjectId[];
|
||||
|
||||
public sourceEndpointInfo: azdata.SchemaCompareEndpointInfo;
|
||||
public targetEndpointInfo: azdata.SchemaCompareEndpointInfo;
|
||||
public sourceEndpointInfo: mssql.SchemaCompareEndpointInfo;
|
||||
public targetEndpointInfo: mssql.SchemaCompareEndpointInfo;
|
||||
|
||||
constructor() {
|
||||
this.SchemaCompareActionMap = new Map<Number, string>();
|
||||
this.SchemaCompareActionMap[azdata.SchemaUpdateAction.Delete] = localize('schemaCompare.deleteAction', 'Delete');
|
||||
this.SchemaCompareActionMap[azdata.SchemaUpdateAction.Change] = localize('schemaCompare.changeAction', 'Change');
|
||||
this.SchemaCompareActionMap[azdata.SchemaUpdateAction.Add] = localize('schemaCompare.addAction', 'Add');
|
||||
this.SchemaCompareActionMap[mssql.SchemaUpdateAction.Delete] = localize('schemaCompare.deleteAction', 'Delete');
|
||||
this.SchemaCompareActionMap[mssql.SchemaUpdateAction.Change] = localize('schemaCompare.changeAction', 'Change');
|
||||
this.SchemaCompareActionMap[mssql.SchemaUpdateAction.Add] = localize('schemaCompare.addAction', 'Add');
|
||||
|
||||
this.editor = azdata.workspace.createModelViewEditor(localize('schemaCompare.Title', 'Schema Compare'), { retainContextWhenHidden: true, supportsSave: true, resourceName: schemaCompareResourceName });
|
||||
}
|
||||
@@ -88,7 +89,7 @@ export class SchemaCompareMainWindow {
|
||||
if (profile) {
|
||||
let ownerUri = await azdata.connection.getUriForConnection((profile.id));
|
||||
this.sourceEndpointInfo = {
|
||||
endpointType: azdata.SchemaCompareEndpointType.Database,
|
||||
endpointType: mssql.SchemaCompareEndpointType.Database,
|
||||
serverDisplayName: `${profile.serverName} ${profile.userName}`,
|
||||
serverName: profile.serverName,
|
||||
databaseName: profile.databaseName,
|
||||
@@ -257,16 +258,16 @@ export class SchemaCompareMainWindow {
|
||||
}
|
||||
|
||||
// only for test
|
||||
public getComparisonResult(): azdata.SchemaCompareResult {
|
||||
public getComparisonResult(): mssql.SchemaCompareResult {
|
||||
return this.comparisonResult;
|
||||
}
|
||||
|
||||
// only for test
|
||||
public getDeploymentOptions(): azdata.DeploymentOptions {
|
||||
public getDeploymentOptions(): mssql.DeploymentOptions {
|
||||
return this.deploymentOptions;
|
||||
}
|
||||
|
||||
public setDeploymentOptions(deploymentOptions: azdata.DeploymentOptions): void {
|
||||
public setDeploymentOptions(deploymentOptions: mssql.DeploymentOptions): void {
|
||||
this.deploymentOptions = deploymentOptions;
|
||||
}
|
||||
|
||||
@@ -348,7 +349,7 @@ export class SchemaCompareMainWindow {
|
||||
this.flexModel.addItem(this.splitView, { CSSStyles: { 'overflow': 'hidden' } });
|
||||
|
||||
// only enable generate script button if the target is a db
|
||||
if (this.targetEndpointInfo.endpointType === azdata.SchemaCompareEndpointType.Database) {
|
||||
if (this.targetEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Database) {
|
||||
this.generateScriptButton.enabled = true;
|
||||
this.applyButton.enabled = true;
|
||||
} else {
|
||||
@@ -435,7 +436,7 @@ export class SchemaCompareMainWindow {
|
||||
}
|
||||
}
|
||||
|
||||
private shouldDiffBeIncluded(diff: azdata.DiffEntry): boolean {
|
||||
private shouldDiffBeIncluded(diff: mssql.DiffEntry): boolean {
|
||||
let key = (diff.sourceValue && diff.sourceValue.length > 0) ? this.createName(diff.sourceValue) : this.createName(diff.targetValue);
|
||||
if (key) {
|
||||
if (this.sourceTargetSwitched === true
|
||||
@@ -453,7 +454,7 @@ export class SchemaCompareMainWindow {
|
||||
return true;
|
||||
}
|
||||
|
||||
private hasExcludeEntry(collection: azdata.SchemaCompareObjectId[], entryName: string): boolean {
|
||||
private hasExcludeEntry(collection: mssql.SchemaCompareObjectId[], entryName: string): boolean {
|
||||
let found = false;
|
||||
if (collection) {
|
||||
const index = collection.findIndex(e => this.createName(e.nameParts) === entryName);
|
||||
@@ -462,7 +463,7 @@ export class SchemaCompareMainWindow {
|
||||
return found;
|
||||
}
|
||||
|
||||
private removeExcludeEntry(collection: azdata.SchemaCompareObjectId[], entryName: string) {
|
||||
private removeExcludeEntry(collection: mssql.SchemaCompareObjectId[], entryName: string) {
|
||||
if (collection) {
|
||||
console.error('removing ' + entryName);
|
||||
const index = collection.findIndex(e => this.createName(e.nameParts) === entryName);
|
||||
@@ -470,12 +471,12 @@ export class SchemaCompareMainWindow {
|
||||
}
|
||||
}
|
||||
|
||||
private getAllDifferences(differences: azdata.DiffEntry[]): string[][] {
|
||||
private getAllDifferences(differences: mssql.DiffEntry[]): string[][] {
|
||||
let data = [];
|
||||
let finalDifferences: azdata.DiffEntry[] = [];
|
||||
let finalDifferences: mssql.DiffEntry[] = [];
|
||||
if (differences) {
|
||||
differences.forEach(difference => {
|
||||
if (difference.differenceType === azdata.SchemaDifferenceType.Object) {
|
||||
if (difference.differenceType === mssql.SchemaDifferenceType.Object) {
|
||||
if ((difference.sourceValue !== null && difference.sourceValue.length > 0) || (difference.targetValue !== null && difference.targetValue.length > 0)) {
|
||||
finalDifferences.push(difference); // Add only non-null changes to ensure index does not mismatch between dictionay and UI - #6234
|
||||
let state: boolean = this.shouldDiffBeIncluded(difference);
|
||||
@@ -495,7 +496,7 @@ export class SchemaCompareMainWindow {
|
||||
return nameParts.join('.');
|
||||
}
|
||||
|
||||
private getFormattedScript(diffEntry: azdata.DiffEntry, getSourceScript: boolean): string {
|
||||
private getFormattedScript(diffEntry: mssql.DiffEntry, getSourceScript: boolean): string {
|
||||
// if there is no entry, the script has to be \n because an empty string shows up as a difference but \n doesn't
|
||||
if ((getSourceScript && diffEntry.sourceScript === null)
|
||||
|| (!getSourceScript && diffEntry.targetScript === null)) {
|
||||
@@ -506,7 +507,7 @@ export class SchemaCompareMainWindow {
|
||||
return script;
|
||||
}
|
||||
|
||||
private getAggregatedScript(diffEntry: azdata.DiffEntry, getSourceScript: boolean): string {
|
||||
private getAggregatedScript(diffEntry: mssql.DiffEntry, getSourceScript: boolean): string {
|
||||
let script = '';
|
||||
if (diffEntry !== null) {
|
||||
let diffEntryScript = getSourceScript ? diffEntry.sourceScript : diffEntry.targetScript;
|
||||
@@ -880,7 +881,7 @@ export class SchemaCompareMainWindow {
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.sourceEndpointInfo && result.sourceEndpointInfo.endpointType === azdata.SchemaCompareEndpointType.Database) {
|
||||
if (result.sourceEndpointInfo && result.sourceEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Database) {
|
||||
// only set endpoint info if able to connect to the database
|
||||
const ownerUri = await verifyConnectionAndGetOwnerUri(result.sourceEndpointInfo);
|
||||
if (ownerUri) {
|
||||
@@ -890,7 +891,7 @@ export class SchemaCompareMainWindow {
|
||||
} else {
|
||||
// need to do this instead of just setting it to the result.sourceEndpointInfo because some fields are null which will cause an error when sending the compare request
|
||||
this.sourceEndpointInfo = {
|
||||
endpointType: azdata.SchemaCompareEndpointType.Dacpac,
|
||||
endpointType: mssql.SchemaCompareEndpointType.Dacpac,
|
||||
serverDisplayName: '',
|
||||
serverName: '',
|
||||
databaseName: '',
|
||||
@@ -900,7 +901,7 @@ export class SchemaCompareMainWindow {
|
||||
};
|
||||
}
|
||||
|
||||
if (result.targetEndpointInfo && result.targetEndpointInfo.endpointType === azdata.SchemaCompareEndpointType.Database) {
|
||||
if (result.targetEndpointInfo && result.targetEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Database) {
|
||||
const ownerUri = await verifyConnectionAndGetOwnerUri(result.targetEndpointInfo);
|
||||
if (ownerUri) {
|
||||
this.targetEndpointInfo = result.targetEndpointInfo;
|
||||
@@ -909,7 +910,7 @@ export class SchemaCompareMainWindow {
|
||||
} else {
|
||||
// need to do this instead of just setting it to the result.targetEndpointInfo because some fields are null which will cause an error when sending the compare request
|
||||
this.targetEndpointInfo = {
|
||||
endpointType: azdata.SchemaCompareEndpointType.Dacpac,
|
||||
endpointType: mssql.SchemaCompareEndpointType.Dacpac,
|
||||
serverDisplayName: '',
|
||||
serverName: '',
|
||||
databaseName: '',
|
||||
@@ -962,8 +963,8 @@ export class SchemaCompareMainWindow {
|
||||
}
|
||||
|
||||
// convert include/exclude maps to arrays of object ids
|
||||
let sourceExcludes: azdata.SchemaCompareObjectId[] = this.convertExcludesToObjectIds(this.originalSourceExcludes);
|
||||
let targetExcludes: azdata.SchemaCompareObjectId[] = this.convertExcludesToObjectIds(this.originalTargetExcludes);
|
||||
let sourceExcludes: mssql.SchemaCompareObjectId[] = this.convertExcludesToObjectIds(this.originalSourceExcludes);
|
||||
let targetExcludes: mssql.SchemaCompareObjectId[] = this.convertExcludesToObjectIds(this.originalTargetExcludes);
|
||||
|
||||
let startTime = Date.now();
|
||||
Telemetry.sendTelemetryEvent('SchemaCompareSaveScmp');
|
||||
@@ -988,9 +989,9 @@ export class SchemaCompareMainWindow {
|
||||
/**
|
||||
* Converts excluded diff entries into object ids which are needed to save them in an scmp
|
||||
*/
|
||||
private convertExcludesToObjectIds(excludedDiffEntries: Map<string, azdata.DiffEntry>): azdata.SchemaCompareObjectId[] {
|
||||
private convertExcludesToObjectIds(excludedDiffEntries: Map<string, mssql.DiffEntry>): mssql.SchemaCompareObjectId[] {
|
||||
let result = [];
|
||||
excludedDiffEntries.forEach((value: azdata.DiffEntry) => {
|
||||
excludedDiffEntries.forEach((value: mssql.DiffEntry) => {
|
||||
result.push({
|
||||
nameParts: value.sourceValue ? value.sourceValue : value.targetValue,
|
||||
sqlObjectType: `Microsoft.Data.Tools.Schema.Sql.SchemaModel.${value.name}`
|
||||
@@ -1002,7 +1003,7 @@ export class SchemaCompareMainWindow {
|
||||
|
||||
private setButtonStatesForNoChanges(enableButtons: boolean): void {
|
||||
// generate script and apply can only be enabled if the target is a database
|
||||
if (this.targetEndpointInfo.endpointType === azdata.SchemaCompareEndpointType.Database) {
|
||||
if (this.targetEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Database) {
|
||||
this.applyButton.enabled = enableButtons;
|
||||
this.generateScriptButton.enabled = enableButtons;
|
||||
this.applyButton.title = enableButtons ? applyEnabledMessage : applyNoChangesMessage;
|
||||
@@ -1010,8 +1011,8 @@ export class SchemaCompareMainWindow {
|
||||
}
|
||||
}
|
||||
|
||||
private static async getService(providerName: string): Promise<azdata.SchemaCompareServicesProvider> {
|
||||
let service = azdata.dataprotocol.getProvider<azdata.SchemaCompareServicesProvider>(providerName, azdata.DataProviderType.SchemaCompareServicesProvider);
|
||||
private static async getService(providerName: string): Promise<mssql.ISchemaCompareService> {
|
||||
let service = (vscode.extensions.getExtension(mssql.extension.name).exports as mssql.mssql).schemaCompare;
|
||||
return service;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
import * as should from 'should';
|
||||
import * as azdata from 'azdata';
|
||||
import * as mssql from '../../../mssql';
|
||||
import 'mocha';
|
||||
import { SchemaCompareDialog } from './../dialogs/schemaCompareDialog';
|
||||
import { SchemaCompareMainWindow } from '../schemaCompareMainWindow';
|
||||
@@ -32,8 +33,8 @@ const mockConnectionProfile: azdata.IConnectionProfile = {
|
||||
const mocksource: string = 'source.dacpac';
|
||||
const mocktarget: string = 'target.dacpac';
|
||||
|
||||
const mockSourceEndpoint: azdata.SchemaCompareEndpointInfo = {
|
||||
endpointType: azdata.SchemaCompareEndpointType.Dacpac,
|
||||
const mockSourceEndpoint: mssql.SchemaCompareEndpointInfo = {
|
||||
endpointType: mssql.SchemaCompareEndpointType.Dacpac,
|
||||
serverDisplayName: '',
|
||||
serverName: '',
|
||||
databaseName: '',
|
||||
@@ -42,8 +43,8 @@ const mockSourceEndpoint: azdata.SchemaCompareEndpointInfo = {
|
||||
connectionDetails: undefined
|
||||
};
|
||||
|
||||
const mockTargetEndpoint: azdata.SchemaCompareEndpointInfo = {
|
||||
endpointType: azdata.SchemaCompareEndpointType.Dacpac,
|
||||
const mockTargetEndpoint: mssql.SchemaCompareEndpointInfo = {
|
||||
endpointType: mssql.SchemaCompareEndpointType.Dacpac,
|
||||
serverDisplayName: '',
|
||||
serverName: '',
|
||||
databaseName: '',
|
||||
@@ -67,7 +68,6 @@ describe('SchemaCompareDialog.openDialog', function (): void {
|
||||
describe('SchemaCompareResult.start', function (): void {
|
||||
it('Should be correct when created.', async function (): Promise<void> {
|
||||
let sc = new SchemaCompareTestService();
|
||||
azdata.dataprotocol.registerSchemaCompareServicesProvider(sc);
|
||||
|
||||
let result = new SchemaCompareMainWindow();
|
||||
await result.start(null);
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as mssql from '../../../mssql';
|
||||
|
||||
export class SchemaCompareTestService implements azdata.SchemaCompareServicesProvider {
|
||||
export class SchemaCompareTestService implements mssql.ISchemaCompareService {
|
||||
|
||||
testOperationId: string = 'Test Operation Id';
|
||||
|
||||
@@ -13,8 +14,8 @@ export class SchemaCompareTestService implements azdata.SchemaCompareServicesPro
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
schemaCompareGetDefaultOptions(): Thenable<azdata.SchemaCompareOptionsResult> {
|
||||
let result: azdata.SchemaCompareOptionsResult = {
|
||||
schemaCompareGetDefaultOptions(): Thenable<mssql.SchemaCompareOptionsResult> {
|
||||
let result: mssql.SchemaCompareOptionsResult = {
|
||||
defaultDeploymentOptions: undefined,
|
||||
success: true,
|
||||
errorMessage: ''
|
||||
@@ -23,21 +24,21 @@ export class SchemaCompareTestService implements azdata.SchemaCompareServicesPro
|
||||
return Promise.resolve(result);
|
||||
}
|
||||
|
||||
schemaCompareIncludeExcludeNode(operationId: string, diffEntry: azdata.DiffEntry, IncludeRequest: boolean, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> {
|
||||
schemaCompareIncludeExcludeNode(operationId: string, diffEntry: mssql.DiffEntry, IncludeRequest: boolean, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
schemaCompareOpenScmp(filePath: string): Thenable<azdata.SchemaCompareOpenScmpResult> {
|
||||
schemaCompareOpenScmp(filePath: string): Thenable<mssql.SchemaCompareOpenScmpResult> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
|
||||
schemaCompareSaveScmp(sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, deploymentOptions: azdata.DeploymentOptions, scmpFilePath: string, excludedSourceObjects: azdata.SchemaCompareObjectId[], excludedTargetObjects: azdata.SchemaCompareObjectId[]): Thenable<azdata.ResultStatus> {
|
||||
schemaCompareSaveScmp(sourceEndpointInfo: mssql.SchemaCompareEndpointInfo, targetEndpointInfo: mssql.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, deploymentOptions: mssql.DeploymentOptions, scmpFilePath: string, excludedSourceObjects: mssql.SchemaCompareObjectId[], excludedTargetObjects: mssql.SchemaCompareObjectId[]): Thenable<azdata.ResultStatus> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
schemaCompare(operationId: string, sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.SchemaCompareResult> {
|
||||
let result: azdata.SchemaCompareResult = {
|
||||
schemaCompare(operationId: string, sourceEndpointInfo: mssql.SchemaCompareEndpointInfo, targetEndpointInfo: mssql.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode): Thenable<mssql.SchemaCompareResult> {
|
||||
let result: mssql.SchemaCompareResult = {
|
||||
operationId: this.testOperationId,
|
||||
areEqual: true,
|
||||
differences: [],
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
'use strict';
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import * as mssql from '../../mssql';
|
||||
|
||||
export interface IPackageInfo {
|
||||
name: string;
|
||||
@@ -39,12 +40,12 @@ export function getTelemetryErrorType(msg: string): string {
|
||||
* Return the appropriate endpoint name depending on if the endpoint is a dacpac or a database
|
||||
* @param endpoint endpoint to get the name of
|
||||
*/
|
||||
export function getEndpointName(endpoint: azdata.SchemaCompareEndpointInfo): string {
|
||||
export function getEndpointName(endpoint: mssql.SchemaCompareEndpointInfo): string {
|
||||
if (!endpoint) {
|
||||
return ' ';
|
||||
}
|
||||
|
||||
if (endpoint.endpointType === azdata.SchemaCompareEndpointType.Database) {
|
||||
if (endpoint.endpointType === mssql.SchemaCompareEndpointType.Database) {
|
||||
if (!endpoint.serverName && endpoint.connectionDetails) {
|
||||
endpoint.serverName = endpoint.connectionDetails['serverName'];
|
||||
}
|
||||
@@ -72,8 +73,8 @@ function connectionInfoToConnectionProfile(details: azdata.ConnectionInfo): azda
|
||||
};
|
||||
}
|
||||
|
||||
export async function verifyConnectionAndGetOwnerUri(endpoint: azdata.SchemaCompareEndpointInfo): Promise<string> {
|
||||
if (endpoint.endpointType === azdata.SchemaCompareEndpointType.Database && endpoint.connectionDetails) {
|
||||
export async function verifyConnectionAndGetOwnerUri(endpoint: mssql.SchemaCompareEndpointInfo): Promise<string> {
|
||||
if (endpoint.endpointType === mssql.SchemaCompareEndpointType.Database && endpoint.connectionDetails) {
|
||||
let connection = await azdata.connection.connect(connectionInfoToConnectionProfile(endpoint.connectionDetails), false, false);
|
||||
|
||||
// show error message if the can't connect to the database
|
||||
@@ -83,4 +84,4 @@ export async function verifyConnectionAndGetOwnerUri(endpoint: azdata.SchemaComp
|
||||
return await azdata.connection.getUriForConnection(connection.connectionId);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user