mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Feature/schemacompare cancel (#6104)
* Schema compare cancel changes for ADS * adding a missed change * Merge from Master * Updating SqltoolsService version * trying stress with bigger runtime * trying one more stress fix with unique operation ids * refactoring test a bit to ensure stress run works
This commit is contained in:
@@ -12,12 +12,14 @@ const path = require('path');
|
|||||||
import { context } from './testContext';
|
import { context } from './testContext';
|
||||||
import assert = require('assert');
|
import assert = require('assert');
|
||||||
import { getStandaloneServer } from './testConfig';
|
import { getStandaloneServer } from './testConfig';
|
||||||
|
import { stressify } from 'adstest';
|
||||||
|
|
||||||
let schemaCompareService: azdata.SchemaCompareServicesProvider;
|
let schemaCompareService: azdata.SchemaCompareServicesProvider;
|
||||||
|
let schemaCompareTester: SchemaCompareTester;
|
||||||
let dacpac1: string = path.join(__dirname, 'testData/Database1.dacpac');
|
let dacpac1: string = path.join(__dirname, 'testData/Database1.dacpac');
|
||||||
let dacpac2: string = path.join(__dirname, 'testData/Database2.dacpac');
|
let dacpac2: string = path.join(__dirname, 'testData/Database2.dacpac');
|
||||||
let dummyDBName: string = 'ads_schemaCompareDB'; // This is used as fill in name and not created anywhere
|
|
||||||
const SERVER_CONNECTION_TIMEOUT: number = 3000;
|
const SERVER_CONNECTION_TIMEOUT: number = 3000;
|
||||||
|
const retryCount = 24; // 2 minutes
|
||||||
|
|
||||||
if (context.RunTest) {
|
if (context.RunTest) {
|
||||||
suite('Schema compare integration test suite', () => {
|
suite('Schema compare integration test suite', () => {
|
||||||
@@ -31,10 +33,29 @@ if (context.RunTest) {
|
|||||||
attempts--;
|
attempts--;
|
||||||
await utils.sleep(1000); // To ensure the providers are registered.
|
await utils.sleep(1000); // To ensure the providers are registered.
|
||||||
}
|
}
|
||||||
|
schemaCompareTester = new SchemaCompareTester();
|
||||||
console.log(`Start schema compare tests`);
|
console.log(`Start schema compare tests`);
|
||||||
});
|
});
|
||||||
test('Schema compare dacpac to dacpac comparison', async function () {
|
test('Schema compare dacpac to dacpac comparison', async function () {
|
||||||
|
await schemaCompareTester.SchemaCompareDacpacToDacpac();
|
||||||
|
});
|
||||||
|
test('Schema compare database to database comparison and script generation', async function () {
|
||||||
|
await schemaCompareTester.SchemaCompareDatabaseToDatabase();
|
||||||
|
});
|
||||||
|
test('Schema compare dacpac to database comparison and script generation', async function () {
|
||||||
|
await schemaCompareTester.SchemaCompareDacpacToDatabase();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class SchemaCompareTester {
|
||||||
|
private static ParallelCount = 1;
|
||||||
|
|
||||||
|
@stressify({ dop: SchemaCompareTester.ParallelCount })
|
||||||
|
async SchemaCompareDacpacToDacpac(): Promise<void> {
|
||||||
assert(schemaCompareService, 'Schema Compare Service Provider is not available');
|
assert(schemaCompareService, 'Schema Compare Service Provider is not available');
|
||||||
|
const now = new Date();
|
||||||
|
const operationId = 'testOperationId_' + now.getTime().toString();
|
||||||
|
|
||||||
let source: azdata.SchemaCompareEndpointInfo = {
|
let source: azdata.SchemaCompareEndpointInfo = {
|
||||||
endpointType: azdata.SchemaCompareEndpointType.Dacpac,
|
endpointType: azdata.SchemaCompareEndpointType.Dacpac,
|
||||||
@@ -53,12 +74,12 @@ if (context.RunTest) {
|
|||||||
ownerUri: '',
|
ownerUri: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
let schemaCompareResult = await schemaCompareService.schemaCompare(source, target, azdata.TaskExecutionMode.execute, null);
|
let schemaCompareResult = await schemaCompareService.schemaCompare(operationId, source, target, azdata.TaskExecutionMode.execute, null);
|
||||||
assertSchemaCompareResult(schemaCompareResult);
|
this.assertSchemaCompareResult(schemaCompareResult, operationId);
|
||||||
});
|
}
|
||||||
|
|
||||||
test('Schema compare database to database comparison and script generation', async function () {
|
|
||||||
|
|
||||||
|
@stressify({ dop: SchemaCompareTester.ParallelCount })
|
||||||
|
async SchemaCompareDatabaseToDatabase(): Promise<void> {
|
||||||
let server = await getStandaloneServer();
|
let server = await getStandaloneServer();
|
||||||
await utils.connectToServer(server, SERVER_CONNECTION_TIMEOUT);
|
await utils.connectToServer(server, SERVER_CONNECTION_TIMEOUT);
|
||||||
|
|
||||||
@@ -68,11 +89,12 @@ if (context.RunTest) {
|
|||||||
let index = nodes.findIndex(node => node.nodePath.includes(server.serverName));
|
let index = nodes.findIndex(node => node.nodePath.includes(server.serverName));
|
||||||
assert(index !== -1, `Failed to find server: "${server.serverName}" in OE tree`);
|
assert(index !== -1, `Failed to find server: "${server.serverName}" in OE tree`);
|
||||||
|
|
||||||
let ownerUri = await azdata.connection.getUriForConnection(nodes[index].connectionId);
|
const ownerUri = await azdata.connection.getUriForConnection(nodes[index].connectionId);
|
||||||
let now = new Date();
|
const now = new Date();
|
||||||
|
|
||||||
let sourceDB: string = 'ads_schemaCompare_sourceDB_' + now.getTime().toString();
|
const operationId = 'testOperationId_' + now.getTime().toString();
|
||||||
let targetDB: string = 'ads_schemaCompare_targetDB_' + now.getTime().toString();
|
const sourceDB: string = 'ads_schemaCompare_sourceDB_' + now.getTime().toString();
|
||||||
|
const targetDB: string = 'ads_schemaCompare_targetDB_' + now.getTime().toString();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let dacfxService = await azdata.dataprotocol.getProvider<azdata.DacFxServicesProvider>('MSSQL', azdata.DataProviderType.DacFxServicesProvider);
|
let dacfxService = await azdata.dataprotocol.getProvider<azdata.DacFxServicesProvider>('MSSQL', azdata.DataProviderType.DacFxServicesProvider);
|
||||||
@@ -82,6 +104,8 @@ if (context.RunTest) {
|
|||||||
|
|
||||||
assert(result1.success === true, 'Deploy source database should succeed');
|
assert(result1.success === true, 'Deploy source database should succeed');
|
||||||
assert(result2.success === true, 'Deploy target database should succeed');
|
assert(result2.success === true, 'Deploy target database should succeed');
|
||||||
|
utils.assertDatabaseCreationResult(sourceDB, ownerUri, retryCount);
|
||||||
|
utils.assertDatabaseCreationResult(targetDB, ownerUri, retryCount);
|
||||||
|
|
||||||
assert(schemaCompareService, 'Schema Compare Service Provider is not available');
|
assert(schemaCompareService, 'Schema Compare Service Provider is not available');
|
||||||
|
|
||||||
@@ -102,22 +126,23 @@ if (context.RunTest) {
|
|||||||
ownerUri: ownerUri,
|
ownerUri: ownerUri,
|
||||||
};
|
};
|
||||||
|
|
||||||
let schemaCompareResult = await schemaCompareService.schemaCompare(source, target, azdata.TaskExecutionMode.execute, null);
|
let schemaCompareResult = await schemaCompareService.schemaCompare(operationId, source, target, azdata.TaskExecutionMode.execute, null);
|
||||||
assertSchemaCompareResult(schemaCompareResult);
|
this.assertSchemaCompareResult(schemaCompareResult, operationId);
|
||||||
|
|
||||||
let status = await schemaCompareService.schemaCompareGenerateScript(schemaCompareResult.operationId, server.serverName, dummyDBName, azdata.TaskExecutionMode.script);
|
let status = await schemaCompareService.schemaCompareGenerateScript(schemaCompareResult.operationId, server.serverName, targetDB, azdata.TaskExecutionMode.script);
|
||||||
|
|
||||||
// TODO : add wait for tasks to complete
|
// TODO : add wait for tasks to complete
|
||||||
// script generation might take too long and the 'success' status does not mean that script is created.
|
// script generation might take too long and the 'success' status does not mean that script is created.
|
||||||
await assertScriptGenerationResult(status);
|
await this.assertScriptGenerationResult(status, target.serverName, target.databaseName);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
await utils.deleteDB(sourceDB, ownerUri);
|
await utils.deleteDB(sourceDB, ownerUri);
|
||||||
await utils.deleteDB(targetDB, ownerUri);
|
await utils.deleteDB(targetDB, ownerUri);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
test('Schema compare dacpac to database comparison and script generation', async function () {
|
@stressify({ dop: SchemaCompareTester.ParallelCount })
|
||||||
|
async SchemaCompareDacpacToDatabase(): Promise<void> {
|
||||||
let server = await getStandaloneServer();
|
let server = await getStandaloneServer();
|
||||||
await utils.connectToServer(server, SERVER_CONNECTION_TIMEOUT);
|
await utils.connectToServer(server, SERVER_CONNECTION_TIMEOUT);
|
||||||
|
|
||||||
@@ -127,9 +152,10 @@ if (context.RunTest) {
|
|||||||
let index = nodes.findIndex(node => node.nodePath.includes(server.serverName));
|
let index = nodes.findIndex(node => node.nodePath.includes(server.serverName));
|
||||||
assert(index !== -1, `Failed to find server: "${server.serverName}" in OE tree`);
|
assert(index !== -1, `Failed to find server: "${server.serverName}" in OE tree`);
|
||||||
|
|
||||||
let ownerUri = await azdata.connection.getUriForConnection(nodes[index].connectionId);
|
const ownerUri = await azdata.connection.getUriForConnection(nodes[index].connectionId);
|
||||||
let now = new Date();
|
const now = new Date();
|
||||||
let targetDB: string = 'ads_schemaCompare_targetDB_' + now.getTime().toString();
|
const operationId = 'testOperationId_' + now.getTime().toString();
|
||||||
|
const targetDB: string = 'ads_schemaCompare_targetDB_' + now.getTime().toString();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let dacfxService = await azdata.dataprotocol.getProvider<azdata.DacFxServicesProvider>('MSSQL', azdata.DataProviderType.DacFxServicesProvider);
|
let dacfxService = await azdata.dataprotocol.getProvider<azdata.DacFxServicesProvider>('MSSQL', azdata.DataProviderType.DacFxServicesProvider);
|
||||||
@@ -156,27 +182,38 @@ if (context.RunTest) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
assert(schemaCompareService, 'Schema Compare Service Provider is not available');
|
assert(schemaCompareService, 'Schema Compare Service Provider is not available');
|
||||||
let schemaCompareResult = await schemaCompareService.schemaCompare(source, target, azdata.TaskExecutionMode.execute, null);
|
|
||||||
assertSchemaCompareResult(schemaCompareResult);
|
|
||||||
|
|
||||||
let status = await schemaCompareService.schemaCompareGenerateScript(schemaCompareResult.operationId, server.serverName, dummyDBName, azdata.TaskExecutionMode.script);
|
let schemaCompareResult = await schemaCompareService.schemaCompare(operationId, source, target, azdata.TaskExecutionMode.execute, null);
|
||||||
await assertScriptGenerationResult(status);
|
this.assertSchemaCompareResult(schemaCompareResult, operationId);
|
||||||
|
|
||||||
|
let status = await schemaCompareService.schemaCompareGenerateScript(schemaCompareResult.operationId, server.serverName, targetDB, azdata.TaskExecutionMode.script);
|
||||||
|
await this.assertScriptGenerationResult(status, target.serverName, target.databaseName);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
await utils.deleteDB(targetDB, ownerUri);
|
await utils.deleteDB(targetDB, ownerUri);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function assertSchemaCompareResult(schemaCompareResult: azdata.SchemaCompareResult): void {
|
private assertSchemaCompareResult(schemaCompareResult: azdata.SchemaCompareResult, operationId : string): void {
|
||||||
assert(schemaCompareResult.areEqual === false, `Expected: the schemas are not to be equal Actual: Equal`);
|
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.errorMessage === null, `Expected: there should be no error. Actual Error message: "${schemaCompareResult.errorMessage}"`);
|
||||||
assert(schemaCompareResult.success === true, `Expected: success in schema compare, Actual: Failure`);
|
assert(schemaCompareResult.success === true, `Expected: success in schema compare, Actual: Failure`);
|
||||||
assert(schemaCompareResult.differences.length === 4, `Expected: 4 differences. Actual differences: "${schemaCompareResult.differences.length}"`);
|
assert(schemaCompareResult.differences.length === 4, `Expected: 4 differences. Actual differences: "${schemaCompareResult.differences.length}"`);
|
||||||
}
|
assert(schemaCompareResult.operationId === operationId, `Operation Id Expected to be same as passed. Expected : ${operationId}, Actual ${schemaCompareResult.operationId}`)
|
||||||
|
}
|
||||||
|
|
||||||
export async function assertScriptGenerationResult(resultstatus: azdata.ResultStatus): Promise<void> {
|
private async assertScriptGenerationResult(resultstatus: azdata.ResultStatus, server: string, database: string): Promise<void> {
|
||||||
// TODO add more validation
|
// TODO add more validation
|
||||||
assert(resultstatus.success === true, `Expected: success true Actual: "${resultstatus.success}" Error Message: "${resultstatus.errorMessage}`);
|
assert(resultstatus.success === true, `Expected: success true Actual: "${resultstatus.success}" Error Message: "${resultstatus.errorMessage}`);
|
||||||
|
const taskService = await azdata.dataprotocol.getProvider<azdata.TaskServicesProvider>('MSSQL', azdata.DataProviderType.TaskServicesProvider);
|
||||||
|
const tasks = await taskService.getAllTasks({ listActiveTasksOnly: true });
|
||||||
|
let foundTask: azdata.TaskInfo;
|
||||||
|
tasks.tasks.forEach(t => {
|
||||||
|
if (t.serverName === server && t.databaseName === database && t.taskExecutionMode === azdata.TaskExecutionMode.script) {
|
||||||
|
foundTask = t;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
assert(foundTask, 'Could not find Script task');
|
||||||
|
assert(foundTask.isCancelable, 'The task should be cancellable');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
||||||
"version": "1.5.0-alpha.100",
|
"version": "1.5.0-alpha.103",
|
||||||
"downloadFileNames": {
|
"downloadFileNames": {
|
||||||
"Windows_86": "win-x86-netcoreapp2.2.zip",
|
"Windows_86": "win-x86-netcoreapp2.2.zip",
|
||||||
"Windows_64": "win-x64-netcoreapp2.2.zip",
|
"Windows_64": "win-x64-netcoreapp2.2.zip",
|
||||||
|
|||||||
@@ -435,6 +435,7 @@ export namespace RemoveServerGroupRequest {
|
|||||||
|
|
||||||
// ------------------------------- <Schema Compare> -----------------------------
|
// ------------------------------- <Schema Compare> -----------------------------
|
||||||
export interface SchemaCompareParams {
|
export interface SchemaCompareParams {
|
||||||
|
operationId: string;
|
||||||
sourceEndpointInfo: azdata.SchemaCompareEndpointInfo;
|
sourceEndpointInfo: azdata.SchemaCompareEndpointInfo;
|
||||||
targetEndpointInfo: azdata.SchemaCompareEndpointInfo;
|
targetEndpointInfo: azdata.SchemaCompareEndpointInfo;
|
||||||
taskExecutionMode: TaskExecutionMode;
|
taskExecutionMode: TaskExecutionMode;
|
||||||
@@ -466,6 +467,10 @@ export interface SchemaCompareNodeParams {
|
|||||||
taskExecutionMode: TaskExecutionMode;
|
taskExecutionMode: TaskExecutionMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SchemaCompareCancelParams {
|
||||||
|
operationId: string;
|
||||||
|
}
|
||||||
|
|
||||||
export namespace SchemaCompareRequest {
|
export namespace SchemaCompareRequest {
|
||||||
export const type = new RequestType<SchemaCompareParams, azdata.SchemaCompareResult, void, void>('schemaCompare/compare');
|
export const type = new RequestType<SchemaCompareParams, azdata.SchemaCompareResult, void, void>('schemaCompare/compare');
|
||||||
}
|
}
|
||||||
@@ -486,4 +491,8 @@ export namespace SchemaCompareIncludeExcludeNodeRequest {
|
|||||||
export const type = new RequestType<SchemaCompareNodeParams, azdata.ResultStatus, void, void>('schemaCompare/includeExcludeNode');
|
export const type = new RequestType<SchemaCompareNodeParams, azdata.ResultStatus, void, void>('schemaCompare/includeExcludeNode');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export namespace SchemaCompareCancellationRequest {
|
||||||
|
export const type = new RequestType<SchemaCompareCancelParams, azdata.ResultStatus, void, void>('schemaCompare/cancel');
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------- <Schema Compare> -----------------------------
|
// ------------------------------- <Schema Compare> -----------------------------
|
||||||
|
|||||||
@@ -167,8 +167,8 @@ export class SchemaCompareServicesFeature extends SqlOpsFeature<undefined> {
|
|||||||
protected registerProvider(options: undefined): Disposable {
|
protected registerProvider(options: undefined): Disposable {
|
||||||
const client = this._client;
|
const client = this._client;
|
||||||
|
|
||||||
let schemaCompare = (sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, deploymentOptions: azdata.DeploymentOptions): Thenable<azdata.SchemaCompareResult> => {
|
let schemaCompare = (operationId: string, sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, deploymentOptions: azdata.DeploymentOptions): Thenable<azdata.SchemaCompareResult> => {
|
||||||
let params: contracts.SchemaCompareParams = { sourceEndpointInfo: sourceEndpointInfo, targetEndpointInfo: targetEndpointInfo, taskExecutionMode: taskExecutionMode, deploymentOptions: deploymentOptions };
|
let params: contracts.SchemaCompareParams = { operationId: operationId, sourceEndpointInfo: sourceEndpointInfo, targetEndpointInfo: targetEndpointInfo, taskExecutionMode: taskExecutionMode, deploymentOptions: deploymentOptions };
|
||||||
return client.sendRequest(contracts.SchemaCompareRequest.type, params).then(
|
return client.sendRequest(contracts.SchemaCompareRequest.type, params).then(
|
||||||
r => {
|
r => {
|
||||||
return r;
|
return r;
|
||||||
@@ -232,13 +232,27 @@ export class SchemaCompareServicesFeature extends SqlOpsFeature<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({
|
return azdata.dataprotocol.registerSchemaCompareServicesProvider({
|
||||||
providerId: client.providerId,
|
providerId: client.providerId,
|
||||||
schemaCompare,
|
schemaCompare,
|
||||||
schemaCompareGenerateScript,
|
schemaCompareGenerateScript,
|
||||||
schemaComparePublishChanges,
|
schemaComparePublishChanges,
|
||||||
schemaCompareGetDefaultOptions,
|
schemaCompareGetDefaultOptions,
|
||||||
schemaCompareIncludeExcludeNode
|
schemaCompareIncludeExcludeNode,
|
||||||
|
schemaCompareCancel
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
extensions/schema-compare/src/media/stop-inverse.svg
Normal file
10
extensions/schema-compare/src/media/stop-inverse.svg
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 23.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
|
||||||
|
<style type="text/css">
|
||||||
|
.st0{fill:#4894FE;}
|
||||||
|
</style>
|
||||||
|
<title>SchemaCompare</title>
|
||||||
|
<rect x="3" y="3" class="st0" width="10" height="10"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 490 B |
10
extensions/schema-compare/src/media/stop.svg
Normal file
10
extensions/schema-compare/src/media/stop.svg
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 23.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
|
||||||
|
<style type="text/css">
|
||||||
|
.st0{fill:#015CDA;}
|
||||||
|
</style>
|
||||||
|
<title>SchemaCompare</title>
|
||||||
|
<rect x="3" y="3" class="st0" width="10" height="10"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 490 B |
@@ -12,6 +12,7 @@ import { SchemaCompareOptionsDialog } from './dialogs/schemaCompareOptionsDialog
|
|||||||
import { Telemetry } from './telemetry';
|
import { Telemetry } from './telemetry';
|
||||||
import { getTelemetryErrorType, getEndpointName } from './utils';
|
import { getTelemetryErrorType, getEndpointName } from './utils';
|
||||||
import { SchemaCompareDialog } from './dialogs/schemaCompareDialog';
|
import { SchemaCompareDialog } from './dialogs/schemaCompareDialog';
|
||||||
|
import { isNullOrUndefined } from 'util';
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
const diffEditorTitle = localize('schemaCompare.CompareDetailsTitle', 'Compare Details');
|
const diffEditorTitle = localize('schemaCompare.CompareDetailsTitle', 'Compare Details');
|
||||||
const applyConfirmation = localize('schemaCompare.ApplyConfirmation', 'Are you sure you want to update the target?');
|
const applyConfirmation = localize('schemaCompare.ApplyConfirmation', 'Are you sure you want to update the target?');
|
||||||
@@ -38,12 +39,14 @@ export class SchemaCompareResult {
|
|||||||
private sourceTargetFlexLayout: azdata.FlexContainer;
|
private sourceTargetFlexLayout: azdata.FlexContainer;
|
||||||
private switchButton: azdata.ButtonComponent;
|
private switchButton: azdata.ButtonComponent;
|
||||||
private compareButton: azdata.ButtonComponent;
|
private compareButton: azdata.ButtonComponent;
|
||||||
|
private cancelCompareButton: azdata.ButtonComponent;
|
||||||
private optionsButton: azdata.ButtonComponent;
|
private optionsButton: azdata.ButtonComponent;
|
||||||
private generateScriptButton: azdata.ButtonComponent;
|
private generateScriptButton: azdata.ButtonComponent;
|
||||||
private applyButton: azdata.ButtonComponent;
|
private applyButton: azdata.ButtonComponent;
|
||||||
private selectSourceButton: azdata.ButtonComponent;
|
private selectSourceButton: azdata.ButtonComponent;
|
||||||
private selectTargetButton: azdata.ButtonComponent;
|
private selectTargetButton: azdata.ButtonComponent;
|
||||||
private SchemaCompareActionMap: Map<Number, string>;
|
private SchemaCompareActionMap: Map<Number, string>;
|
||||||
|
private operationId: string;
|
||||||
private comparisonResult: azdata.SchemaCompareResult;
|
private comparisonResult: azdata.SchemaCompareResult;
|
||||||
private sourceNameComponent: azdata.TableComponent;
|
private sourceNameComponent: azdata.TableComponent;
|
||||||
private targetNameComponent: azdata.TableComponent;
|
private targetNameComponent: azdata.TableComponent;
|
||||||
@@ -112,6 +115,7 @@ export class SchemaCompareResult {
|
|||||||
|
|
||||||
this.createSwitchButton(view);
|
this.createSwitchButton(view);
|
||||||
this.createCompareButton(view);
|
this.createCompareButton(view);
|
||||||
|
this.createCancelButton(view);
|
||||||
this.createGenerateScriptButton(view);
|
this.createGenerateScriptButton(view);
|
||||||
this.createApplyButton(view);
|
this.createApplyButton(view);
|
||||||
this.createOptionsButton(view);
|
this.createOptionsButton(view);
|
||||||
@@ -121,6 +125,8 @@ export class SchemaCompareResult {
|
|||||||
let toolBar = view.modelBuilder.toolbarContainer();
|
let toolBar = view.modelBuilder.toolbarContainer();
|
||||||
toolBar.addToolbarItems([{
|
toolBar.addToolbarItems([{
|
||||||
component: this.compareButton
|
component: this.compareButton
|
||||||
|
}, {
|
||||||
|
component: this.cancelCompareButton
|
||||||
}, {
|
}, {
|
||||||
component: this.generateScriptButton
|
component: this.generateScriptButton
|
||||||
}, {
|
}, {
|
||||||
@@ -247,7 +253,11 @@ export class SchemaCompareResult {
|
|||||||
}
|
}
|
||||||
Telemetry.sendTelemetryEvent('SchemaComparisonStarted');
|
Telemetry.sendTelemetryEvent('SchemaComparisonStarted');
|
||||||
const service = await SchemaCompareResult.getService('MSSQL');
|
const service = await SchemaCompareResult.getService('MSSQL');
|
||||||
this.comparisonResult = await service.schemaCompare(this.sourceEndpointInfo, this.targetEndpointInfo, azdata.TaskExecutionMode.execute, this.deploymentOptions);
|
if (!this.operationId) {
|
||||||
|
// create once per page
|
||||||
|
this.operationId = generateGuid();
|
||||||
|
}
|
||||||
|
this.comparisonResult = await service.schemaCompare(this.operationId, this.sourceEndpointInfo, this.targetEndpointInfo, azdata.TaskExecutionMode.execute, this.deploymentOptions);
|
||||||
if (!this.comparisonResult || !this.comparisonResult.success) {
|
if (!this.comparisonResult || !this.comparisonResult.success) {
|
||||||
Telemetry.sendTelemetryEventForError('SchemaComparisonFailed', {
|
Telemetry.sendTelemetryEventForError('SchemaComparisonFailed', {
|
||||||
'errorType': getTelemetryErrorType(this.comparisonResult.errorMessage),
|
'errorType': getTelemetryErrorType(this.comparisonResult.errorMessage),
|
||||||
@@ -314,6 +324,7 @@ export class SchemaCompareResult {
|
|||||||
this.switchButton.enabled = true;
|
this.switchButton.enabled = true;
|
||||||
this.compareButton.enabled = true;
|
this.compareButton.enabled = true;
|
||||||
this.optionsButton.enabled = true;
|
this.optionsButton.enabled = true;
|
||||||
|
this.cancelCompareButton.enabled = false;
|
||||||
|
|
||||||
if (this.comparisonResult.differences.length > 0) {
|
if (this.comparisonResult.differences.length > 0) {
|
||||||
this.flexModel.addItem(this.splitView, { CSSStyles: { 'overflow': 'hidden' } });
|
this.flexModel.addItem(this.splitView, { CSSStyles: { 'overflow': 'hidden' } });
|
||||||
@@ -372,7 +383,7 @@ export class SchemaCompareResult {
|
|||||||
private saveExcludeState(rowState: azdata.ICheckboxCellActionEventArgs) {
|
private saveExcludeState(rowState: azdata.ICheckboxCellActionEventArgs) {
|
||||||
if (rowState) {
|
if (rowState) {
|
||||||
let diff = this.comparisonResult.differences[rowState.row];
|
let diff = this.comparisonResult.differences[rowState.row];
|
||||||
let key = diff.sourceValue ? diff.sourceValue : diff.targetValue;
|
let key = (diff.sourceValue && diff.sourceValue.length > 0) ? this.createName(diff.sourceValue) : this.createName(diff.targetValue);
|
||||||
if (key) {
|
if (key) {
|
||||||
if (!this.sourceTargetSwitched) {
|
if (!this.sourceTargetSwitched) {
|
||||||
this.originalSourceExcludes.delete(key);
|
this.originalSourceExcludes.delete(key);
|
||||||
@@ -403,7 +414,7 @@ export class SchemaCompareResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private shouldDiffBeIncluded(diff: azdata.DiffEntry): boolean {
|
private shouldDiffBeIncluded(diff: azdata.DiffEntry): boolean {
|
||||||
let key = diff.sourceValue ? diff.sourceValue : diff.targetValue;
|
let key = (diff.sourceValue && diff.sourceValue.length > 0) ? this.createName(diff.sourceValue) : this.createName(diff.targetValue);
|
||||||
if (key) {
|
if (key) {
|
||||||
if (this.sourceTargetSwitched === true && this.originalTargetExcludes.has(key)) {
|
if (this.sourceTargetSwitched === true && this.originalTargetExcludes.has(key)) {
|
||||||
this.originalTargetExcludes[key] = diff;
|
this.originalTargetExcludes[key] = diff;
|
||||||
@@ -423,9 +434,9 @@ export class SchemaCompareResult {
|
|||||||
if (differences) {
|
if (differences) {
|
||||||
differences.forEach(difference => {
|
differences.forEach(difference => {
|
||||||
if (difference.differenceType === azdata.SchemaDifferenceType.Object) {
|
if (difference.differenceType === azdata.SchemaDifferenceType.Object) {
|
||||||
if (difference.sourceValue !== null || difference.targetValue !== null) {
|
if ((difference.sourceValue !== null && difference.sourceValue.length > 0) || (difference.targetValue !== null && difference.targetValue.length > 0)) {
|
||||||
let state: boolean = this.shouldDiffBeIncluded(difference);
|
let state: boolean = this.shouldDiffBeIncluded(difference);
|
||||||
data.push([difference.name, difference.sourceValue, state, this.SchemaCompareActionMap[difference.updateAction], difference.targetValue]);
|
data.push([difference.name, this.createName(difference.sourceValue), state, this.SchemaCompareActionMap[difference.updateAction], this.createName(difference.targetValue)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -434,6 +445,13 @@ export class SchemaCompareResult {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private createName(nameParts: string[]): string {
|
||||||
|
if (isNullOrUndefined(nameParts) || nameParts.length === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return nameParts.join('.');
|
||||||
|
}
|
||||||
|
|
||||||
private getFormattedScript(diffEntry: azdata.DiffEntry, getSourceScript: boolean): string {
|
private getFormattedScript(diffEntry: azdata.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 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)
|
if ((getSourceScript && diffEntry.sourceScript === null)
|
||||||
@@ -497,6 +515,54 @@ export class SchemaCompareResult {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private createCancelButton(view: azdata.ModelView): void {
|
||||||
|
this.cancelCompareButton = view.modelBuilder.button().withProperties({
|
||||||
|
label: localize('schemaCompare.cancelCompareButton', 'Stop'),
|
||||||
|
iconPath: {
|
||||||
|
light: path.join(__dirname, 'media', 'stop.svg'),
|
||||||
|
dark: path.join(__dirname, 'media', 'stop-inverse.svg')
|
||||||
|
},
|
||||||
|
title: localize('schemaCompare.cancelCompareButtonTitle', 'Stop')
|
||||||
|
}).component();
|
||||||
|
|
||||||
|
this.cancelCompareButton.onDidClick(async (click) => {
|
||||||
|
await this.cancelCompare();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private async cancelCompare() {
|
||||||
|
|
||||||
|
Telemetry.sendTelemetryEvent('SchemaCompareCancelStarted', {
|
||||||
|
'startTime:': Date.now().toString(),
|
||||||
|
'operationId': this.operationId
|
||||||
|
});
|
||||||
|
|
||||||
|
// clean the pane
|
||||||
|
this.flexModel.removeItem(this.loader);
|
||||||
|
this.flexModel.removeItem(this.waitText);
|
||||||
|
this.flexModel.addItem(this.startText, { CSSStyles: { 'margin': 'auto' } });
|
||||||
|
this.resetButtons(true);
|
||||||
|
|
||||||
|
// cancel compare
|
||||||
|
if (this.operationId) {
|
||||||
|
const service = await SchemaCompareResult.getService('MSSQL');
|
||||||
|
const result = await service.schemaCompareCancel(this.operationId);
|
||||||
|
|
||||||
|
if (!result || !result.success) {
|
||||||
|
Telemetry.sendTelemetryEvent('SchemaCompareCancelFailed', {
|
||||||
|
'errorType': getTelemetryErrorType(result.errorMessage),
|
||||||
|
'operationId': this.operationId
|
||||||
|
});
|
||||||
|
vscode.window.showErrorMessage(
|
||||||
|
localize('schemaCompare.cancelErrorMessage', "Cancel schema compare failed: '{0}'", (result && result.errorMessage) ? result.errorMessage : 'Unknown'));
|
||||||
|
}
|
||||||
|
Telemetry.sendTelemetryEvent('SchemaCompareCancelEnded', {
|
||||||
|
'endTime:': Date.now().toString(),
|
||||||
|
'operationId': this.operationId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private createGenerateScriptButton(view: azdata.ModelView): void {
|
private createGenerateScriptButton(view: azdata.ModelView): void {
|
||||||
this.generateScriptButton = view.modelBuilder.button().withProperties({
|
this.generateScriptButton = view.modelBuilder.button().withProperties({
|
||||||
label: localize('schemaCompare.generateScriptButton', 'Generate script'),
|
label: localize('schemaCompare.generateScriptButton', 'Generate script'),
|
||||||
@@ -606,11 +672,13 @@ export class SchemaCompareResult {
|
|||||||
this.compareButton.enabled = true;
|
this.compareButton.enabled = true;
|
||||||
this.optionsButton.enabled = true;
|
this.optionsButton.enabled = true;
|
||||||
this.switchButton.enabled = true;
|
this.switchButton.enabled = true;
|
||||||
|
this.cancelCompareButton.enabled = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.compareButton.enabled = false;
|
this.compareButton.enabled = false;
|
||||||
this.optionsButton.enabled = false;
|
this.optionsButton.enabled = false;
|
||||||
this.switchButton.enabled = false;
|
this.switchButton.enabled = false;
|
||||||
|
this.cancelCompareButton.enabled = true;
|
||||||
}
|
}
|
||||||
this.generateScriptButton.enabled = false;
|
this.generateScriptButton.enabled = false;
|
||||||
this.applyButton.enabled = false;
|
this.applyButton.enabled = false;
|
||||||
@@ -714,3 +782,29 @@ export class SchemaCompareResult {
|
|||||||
this.deploymentOptions = result.defaultDeploymentOptions;
|
this.deploymentOptions = result.defaultDeploymentOptions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Borrowed as is from other extensions
|
||||||
|
// TODO : figure out if any inbuilt alternative is available
|
||||||
|
export function generateGuid(): string {
|
||||||
|
let hexValues: string[] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'];
|
||||||
|
// c.f. rfc4122 (UUID version 4 = xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx)
|
||||||
|
let oct: string = '';
|
||||||
|
let tmp: number;
|
||||||
|
/* tslint:disable:no-bitwise */
|
||||||
|
for (let a: number = 0; a < 4; a++) {
|
||||||
|
tmp = (4294967296 * Math.random()) | 0;
|
||||||
|
oct += hexValues[tmp & 0xF] +
|
||||||
|
hexValues[tmp >> 4 & 0xF] +
|
||||||
|
hexValues[tmp >> 8 & 0xF] +
|
||||||
|
hexValues[tmp >> 12 & 0xF] +
|
||||||
|
hexValues[tmp >> 16 & 0xF] +
|
||||||
|
hexValues[tmp >> 20 & 0xF] +
|
||||||
|
hexValues[tmp >> 24 & 0xF] +
|
||||||
|
hexValues[tmp >> 28 & 0xF];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 'Set the two most significant bits (bits 6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively'
|
||||||
|
let clockSequenceHi: string = hexValues[8 + (Math.random() * 4) | 0];
|
||||||
|
return oct.substr(0, 8) + '-' + oct.substr(9, 4) + '-4' + oct.substr(13, 3) + '-' + clockSequenceHi + oct.substr(16, 3) + '-' + oct.substr(19, 12);
|
||||||
|
/* tslint:enable:no-bitwise */
|
||||||
|
}
|
||||||
@@ -69,7 +69,7 @@ describe('SchemaCompareResult.start', function (): void {
|
|||||||
|
|
||||||
let result = new SchemaCompareResult();
|
let result = new SchemaCompareResult();
|
||||||
await result.start(null);
|
await result.start(null);
|
||||||
let promise = new Promise(resolve => setTimeout(resolve, 3000)); // to ensure comparision result view is initialized
|
let promise = new Promise(resolve => setTimeout(resolve, 5000)); // to ensure comparison result view is initialized
|
||||||
await promise;
|
await promise;
|
||||||
|
|
||||||
should(result.getComparisonResult() === undefined);
|
should(result.getComparisonResult() === undefined);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export class SchemaCompareTestService implements azdata.SchemaCompareServicesPro
|
|||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
|
|
||||||
schemaCompare(sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.SchemaCompareResult> {
|
schemaCompare(operationId: string, sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.SchemaCompareResult> {
|
||||||
let result: azdata.SchemaCompareResult = {
|
let result: azdata.SchemaCompareResult = {
|
||||||
operationId: this.testOperationId,
|
operationId: this.testOperationId,
|
||||||
areEqual: true,
|
areEqual: true,
|
||||||
@@ -39,7 +39,11 @@ export class SchemaCompareTestService implements azdata.SchemaCompareServicesPro
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
schemaCompareGenerateScript(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.DacFxResult> {
|
schemaCompareGenerateScript(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
schemaCompareCancel(operationId: string): Thenable<azdata.ResultStatus> {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
13
src/sql/azdata.proposed.d.ts
vendored
13
src/sql/azdata.proposed.d.ts
vendored
@@ -1740,12 +1740,18 @@ declare module 'azdata' {
|
|||||||
differences: DiffEntry[];
|
differences: DiffEntry[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SchemaCompareCompletionResult extends ResultStatus {
|
||||||
|
operationId: string;
|
||||||
|
areEqual: boolean;
|
||||||
|
differences: DiffEntry[];
|
||||||
|
}
|
||||||
|
|
||||||
export interface DiffEntry {
|
export interface DiffEntry {
|
||||||
updateAction: SchemaUpdateAction;
|
updateAction: SchemaUpdateAction;
|
||||||
differenceType: SchemaDifferenceType;
|
differenceType: SchemaDifferenceType;
|
||||||
name: string;
|
name: string;
|
||||||
sourceValue: string;
|
sourceValue: string[];
|
||||||
targetValue: string;
|
targetValue: string[];
|
||||||
parent: DiffEntry;
|
parent: DiffEntry;
|
||||||
children: DiffEntry[];
|
children: DiffEntry[];
|
||||||
sourceScript: string;
|
sourceScript: string;
|
||||||
@@ -1930,11 +1936,12 @@ declare module 'azdata' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface SchemaCompareServicesProvider extends DataProvider {
|
export interface SchemaCompareServicesProvider extends DataProvider {
|
||||||
schemaCompare(sourceEndpointInfo: SchemaCompareEndpointInfo, targetEndpointInfo: SchemaCompareEndpointInfo, taskExecutionMode: TaskExecutionMode, deploymentOptions: DeploymentOptions): Thenable<SchemaCompareResult>;
|
schemaCompare(operationId: string, sourceEndpointInfo: SchemaCompareEndpointInfo, targetEndpointInfo: SchemaCompareEndpointInfo, taskExecutionMode: TaskExecutionMode, deploymentOptions: DeploymentOptions): Thenable<SchemaCompareResult>;
|
||||||
schemaCompareGenerateScript(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: TaskExecutionMode): Thenable<ResultStatus>;
|
schemaCompareGenerateScript(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: TaskExecutionMode): Thenable<ResultStatus>;
|
||||||
schemaComparePublishChanges(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: TaskExecutionMode): Thenable<ResultStatus>;
|
schemaComparePublishChanges(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: TaskExecutionMode): Thenable<ResultStatus>;
|
||||||
schemaCompareGetDefaultOptions(): Thenable<SchemaCompareOptionsResult>;
|
schemaCompareGetDefaultOptions(): Thenable<SchemaCompareOptionsResult>;
|
||||||
schemaCompareIncludeExcludeNode(operationId: string, diffEntry: DiffEntry, IncludeRequest: boolean, taskExecutionMode: TaskExecutionMode): Thenable<ResultStatus>;
|
schemaCompareIncludeExcludeNode(operationId: string, diffEntry: DiffEntry, IncludeRequest: boolean, taskExecutionMode: TaskExecutionMode): Thenable<ResultStatus>;
|
||||||
|
schemaCompareCancel(operationId: string): Thenable<ResultStatus>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Security service interfaces ------------------------------------------------------------------------
|
// Security service interfaces ------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -15,11 +15,12 @@ export interface ISchemaCompareService {
|
|||||||
_serviceBrand: any;
|
_serviceBrand: any;
|
||||||
|
|
||||||
registerProvider(providerId: string, provider: azdata.SchemaCompareServicesProvider): void;
|
registerProvider(providerId: string, provider: azdata.SchemaCompareServicesProvider): void;
|
||||||
schemaCompare(sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, deploymentOptions: azdata.DeploymentOptions): void;
|
schemaCompare(operationId: string, sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, deploymentOptions: azdata.DeploymentOptions): void;
|
||||||
schemaCompareGenerateScript(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): void;
|
schemaCompareGenerateScript(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): void;
|
||||||
schemaComparePublishChanges(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): void;
|
schemaComparePublishChanges(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): void;
|
||||||
schemaCompareGetDefaultOptions(): void;
|
schemaCompareGetDefaultOptions(): void;
|
||||||
schemaCompareIncludeExcludeNode(operationId: string, diffEntry: azdata.DiffEntry, includeRequest: boolean, taskExecutionMode: azdata.TaskExecutionMode): void;
|
schemaCompareIncludeExcludeNode(operationId: string, diffEntry: azdata.DiffEntry, includeRequest: boolean, taskExecutionMode: azdata.TaskExecutionMode): void;
|
||||||
|
schemaCompareCancel(operationId: string): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SchemaCompareService implements ISchemaCompareService {
|
export class SchemaCompareService implements ISchemaCompareService {
|
||||||
@@ -32,9 +33,9 @@ export class SchemaCompareService implements ISchemaCompareService {
|
|||||||
this._providers[providerId] = provider;
|
this._providers[providerId] = provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
schemaCompare(sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, deploymentOptions: azdata.DeploymentOptions): Thenable<azdata.SchemaCompareResult> {
|
schemaCompare(operationId: string, sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, deploymentOptions: azdata.DeploymentOptions): Thenable<azdata.SchemaCompareResult> {
|
||||||
return this._runAction(sourceEndpointInfo.ownerUri, (runner) => {
|
return this._runAction(sourceEndpointInfo.ownerUri, (runner) => {
|
||||||
return runner.schemaCompare(sourceEndpointInfo, targetEndpointInfo, taskExecutionMode, deploymentOptions);
|
return runner.schemaCompare(operationId, sourceEndpointInfo, targetEndpointInfo, taskExecutionMode, deploymentOptions);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,6 +63,12 @@ export class SchemaCompareService implements ISchemaCompareService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
schemaCompareCancel(operationId: string): Thenable<azdata.ResultStatus> {
|
||||||
|
return this._runAction('', (runner) => {
|
||||||
|
return runner.schemaCompareCancel(operationId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private _runAction<T>(uri: string, action: (handler: azdata.SchemaCompareServicesProvider) => Thenable<T>): Thenable<T> {
|
private _runAction<T>(uri: string, action: (handler: azdata.SchemaCompareServicesProvider) => Thenable<T>): Thenable<T> {
|
||||||
let providerId: string = this._connectionService.getProviderIdFromUri(uri);
|
let providerId: string = this._connectionService.getProviderIdFromUri(uri);
|
||||||
|
|
||||||
|
|||||||
@@ -470,8 +470,8 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
|
|||||||
public $registerSchemaCompareServicesProvider(providerId: string, handle: number): Promise<any> {
|
public $registerSchemaCompareServicesProvider(providerId: string, handle: number): Promise<any> {
|
||||||
const self = this;
|
const self = this;
|
||||||
this._schemaCompareService.registerProvider(providerId, <azdata.SchemaCompareServicesProvider>{
|
this._schemaCompareService.registerProvider(providerId, <azdata.SchemaCompareServicesProvider>{
|
||||||
schemaCompare(sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, schemaComapareOptions: azdata.DeploymentOptions): Thenable<azdata.SchemaCompareResult> {
|
schemaCompare(operationId: string, sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, schemaComapareOptions: azdata.DeploymentOptions): Thenable<azdata.SchemaCompareResult> {
|
||||||
return self._proxy.$schemaCompare(handle, sourceEndpointInfo, targetEndpointInfo, taskExecutionMode, schemaComapareOptions);
|
return self._proxy.$schemaCompare(handle, operationId, sourceEndpointInfo, targetEndpointInfo, taskExecutionMode, schemaComapareOptions);
|
||||||
},
|
},
|
||||||
schemaCompareGenerateScript(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> {
|
schemaCompareGenerateScript(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> {
|
||||||
return self._proxy.$schemaCompareGenerateScript(handle, operationId, targetServerName, targetDatabaseName, taskExecutionMode);
|
return self._proxy.$schemaCompareGenerateScript(handle, operationId, targetServerName, targetDatabaseName, taskExecutionMode);
|
||||||
@@ -484,6 +484,9 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
|
|||||||
},
|
},
|
||||||
schemaCompareIncludeExcludeNode(operationId: string, diffEntry: azdata.DiffEntry, includeRequest: boolean, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> {
|
schemaCompareIncludeExcludeNode(operationId: string, diffEntry: azdata.DiffEntry, includeRequest: boolean, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> {
|
||||||
return self._proxy.$schemaCompareIncludeExcludeNode(handle, operationId, diffEntry, includeRequest, taskExecutionMode);
|
return self._proxy.$schemaCompareIncludeExcludeNode(handle, operationId, diffEntry, includeRequest, taskExecutionMode);
|
||||||
|
},
|
||||||
|
schemaCompareCancel(operationId: string): Thenable<azdata.ResultStatus> {
|
||||||
|
return self._proxy.$schemaCompareCancel(handle, operationId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -465,7 +465,7 @@ export abstract class ExtHostDataProtocolShape {
|
|||||||
/**
|
/**
|
||||||
* Schema compare
|
* Schema compare
|
||||||
*/
|
*/
|
||||||
$schemaCompare(handle: number, sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, schemaComapareOptions: azdata.DeploymentOptions): Thenable<azdata.SchemaCompareResult> { throw ni(); }
|
$schemaCompare(handle: number, operationId: string, sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode, schemaComapareOptions: azdata.DeploymentOptions): Thenable<azdata.SchemaCompareResult> { throw ni(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schema compare generate script
|
* Schema compare generate script
|
||||||
@@ -487,6 +487,12 @@ export abstract class ExtHostDataProtocolShape {
|
|||||||
* Schema compare Include node
|
* Schema compare Include node
|
||||||
*/
|
*/
|
||||||
$schemaCompareIncludeExcludeNode(handle: number, operationId: string, diffEntry: azdata.DiffEntry, includeRequest: boolean, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> { throw ni(); }
|
$schemaCompareIncludeExcludeNode(handle: number, operationId: string, diffEntry: azdata.DiffEntry, includeRequest: boolean, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> { throw ni(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Schema compare cancel
|
||||||
|
*/
|
||||||
|
$schemaCompareCancel(handle: number, operationId: string): Thenable<azdata.ResultStatus> { throw ni(); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user