Apply changes from Remote Database to sqlproj - mssql changes (#17655)

* update project from database

* update project from database

* update project from database

* Re-adding schemaComparePublishChanges for temporary backcompat

* Adding comment for keeping enum values in sync

* Correcting enum value

Co-authored-by: Noureldine Yehia <t-nyehia@microsoft.com>
This commit is contained in:
Benjin Dubishar
2021-11-15 15:42:56 -08:00
committed by GitHub
parent d6159a2370
commit b5f8e81250
8 changed files with 163 additions and 19 deletions

View File

@@ -97,7 +97,11 @@ export class SchemaCompareDialog {
databaseName: '',
ownerUri: '',
packageFilePath: this.sourceTextBox.value,
connectionDetails: undefined
connectionDetails: undefined,
projectFilePath: '',
folderStructure: '',
targetScripts: [],
dataSchemaProvider: ''
};
} else {
const sourceServerDropdownValue = this.sourceServerDropdown.value as ConnectionDropdownValue;
@@ -111,7 +115,11 @@ export class SchemaCompareDialog {
ownerUri: ownerUri,
packageFilePath: '',
connectionDetails: undefined,
connectionName: sourceServerDropdownValue.connection.options.connectionName
connectionName: sourceServerDropdownValue.connection.options.connectionName,
projectFilePath: '',
folderStructure: '',
targetScripts: [],
dataSchemaProvider: ''
};
}
@@ -123,7 +131,11 @@ export class SchemaCompareDialog {
databaseName: '',
ownerUri: '',
packageFilePath: this.targetTextBox.value,
connectionDetails: undefined
connectionDetails: undefined,
projectFilePath: '',
folderStructure: '',
targetScripts: [],
dataSchemaProvider: ''
};
} else {
const targetServerDropdownValue = this.targetServerDropdown.value as ConnectionDropdownValue;
@@ -137,7 +149,11 @@ export class SchemaCompareDialog {
ownerUri: ownerUri,
packageFilePath: '',
connectionDetails: undefined,
connectionName: targetServerDropdownValue.connection.options.connectionName
connectionName: targetServerDropdownValue.connection.options.connectionName,
projectFilePath: '',
folderStructure: '',
targetScripts: [],
dataSchemaProvider: ''
};
}

View File

@@ -104,7 +104,11 @@ export class SchemaCompareMainWindow {
ownerUri: ownerUri,
packageFilePath: '',
connectionDetails: undefined,
connectionName: profile.connectionName
connectionName: profile.connectionName,
projectFilePath: '',
folderStructure: '',
targetScripts: [],
dataSchemaProvider: ''
};
} else if (sourceDacpac) {
this.sourceEndpointInfo = {
@@ -114,7 +118,11 @@ export class SchemaCompareMainWindow {
databaseName: '',
ownerUri: '',
packageFilePath: sourceDacpac,
connectionDetails: undefined
connectionDetails: undefined,
projectFilePath: '',
folderStructure: '',
targetScripts: [],
dataSchemaProvider: ''
};
}
@@ -776,7 +784,7 @@ export class SchemaCompareMainWindow {
// disable apply and generate script buttons because the results are no longer valid after applying the changes
this.setButtonsForRecompare();
const service = await this.getService();
const service: mssql.ISchemaCompareService = await this.getService();
const result = await service.schemaComparePublishChanges(this.comparisonResult.operationId, this.targetEndpointInfo.serverName, this.targetEndpointInfo.databaseName, azdata.TaskExecutionMode.execute);
if (!result || !result.success) {
TelemetryReporter.createErrorEvent(TelemetryViews.SchemaCompareMainWindow, 'SchemaCompareApplyFailed', undefined, getTelemetryErrorType(result.errorMessage))

View File

@@ -24,6 +24,14 @@ export class SchemaCompareTestService implements mssql.ISchemaCompareService {
throw new Error('Method not implemented.');
}
schemaComparePublishDatabaseChanges(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> {
throw new Error('Method not implemented.');
}
schemaComparePublishProjectChanges(operationId: string, targetProjectPath: string, targetFolderStructure: mssql.ExtractTarget, taskExecutionMode: azdata.TaskExecutionMode): Thenable<mssql.SchemaComparePublishProjectResult> {
throw new Error('Method not implemented.');
}
schemaCompareGetDefaultOptions(): Thenable<mssql.SchemaCompareOptionsResult> {
let result: mssql.SchemaCompareOptionsResult = {
defaultDeploymentOptions: undefined,
@@ -42,7 +50,6 @@ export class SchemaCompareTestService implements mssql.ISchemaCompareService {
throw new Error('Method not implemented.');
}
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.');
}

View File

@@ -94,7 +94,11 @@ export const mockDacpacEndpoint: mssql.SchemaCompareEndpointInfo = {
databaseName: '',
ownerUri: '',
packageFilePath: mockFilePath,
connectionDetails: undefined
connectionDetails: undefined,
projectFilePath: '',
folderStructure: '',
targetScripts: [],
dataSchemaProvider: ''
};
export const mockDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = {
@@ -104,7 +108,11 @@ export const mockDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = {
databaseName: '',
ownerUri: '',
packageFilePath: '',
connectionDetails: undefined
connectionDetails: undefined,
projectFilePath: '',
folderStructure: '',
targetScripts: [],
dataSchemaProvider: ''
};
export async function shouldThrowSpecificError(block: Function, expectedMessage: string, details?: string) {