fix compare after opening scmp with dacpacs failing (#6201)

This commit is contained in:
Kim Santiago
2019-06-27 18:26:02 -07:00
committed by GitHub
parent 4ef25ecf37
commit b34e3cbe90
2 changed files with 21 additions and 6 deletions

View File

@@ -177,7 +177,7 @@ export class SchemaCompareDialog {
private endpointChanged(previousEndpoint: azdata.SchemaCompareEndpointInfo, updatedEndpoint: azdata.SchemaCompareEndpointInfo): boolean { private endpointChanged(previousEndpoint: azdata.SchemaCompareEndpointInfo, updatedEndpoint: azdata.SchemaCompareEndpointInfo): boolean {
if (previousEndpoint && updatedEndpoint) { if (previousEndpoint && updatedEndpoint) {
return getEndpointName(previousEndpoint).toLowerCase() !== getEndpointName(updatedEndpoint).toLowerCase() return getEndpointName(previousEndpoint).toLowerCase() !== getEndpointName(updatedEndpoint).toLowerCase()
|| previousEndpoint.serverDisplayName.toLocaleLowerCase() !== updatedEndpoint.serverDisplayName.toLowerCase(); || (previousEndpoint.serverDisplayName && updatedEndpoint.serverDisplayName && previousEndpoint.serverDisplayName.toLowerCase() !== updatedEndpoint.serverDisplayName.toLowerCase());
} }
return false; return false;
} }
@@ -541,9 +541,6 @@ export class SchemaCompareDialog {
} }
let finalName = `${srv} (${usr})`; let finalName = `${srv} (${usr})`;
if (endpointInfo) {
console.error('finalname: ' + finalName + ' endpointname: ' + endpointInfo.serverDisplayName);
}
// use previously selected server or current connection if there is one // use previously selected server or current connection if there is one
if (endpointInfo && !isNullOrUndefined(endpointInfo.serverName) && !isNullOrUndefined(endpointInfo.serverDisplayName) if (endpointInfo && !isNullOrUndefined(endpointInfo.serverName) && !isNullOrUndefined(endpointInfo.serverDisplayName)
&& c.options.server.toLowerCase() === endpointInfo.serverName.toLowerCase() && c.options.server.toLowerCase() === endpointInfo.serverName.toLowerCase()

View File

@@ -880,7 +880,16 @@ export class SchemaCompareResult {
this.sourceEndpointInfo.ownerUri = ownerUri; this.sourceEndpointInfo.ownerUri = ownerUri;
} }
} else { } else {
this.sourceEndpointInfo = result.sourceEndpointInfo; // 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,
serverDisplayName: '',
serverName: '',
databaseName: '',
ownerUri: '',
packageFilePath: result.sourceEndpointInfo.packageFilePath,
connectionDetails: undefined
};
} }
if (result.targetEndpointInfo && result.targetEndpointInfo.endpointType === azdata.SchemaCompareEndpointType.Database) { if (result.targetEndpointInfo && result.targetEndpointInfo.endpointType === azdata.SchemaCompareEndpointType.Database) {
@@ -890,7 +899,16 @@ export class SchemaCompareResult {
this.targetEndpointInfo.ownerUri = ownerUri; this.targetEndpointInfo.ownerUri = ownerUri;
} }
} else { } else {
this.targetEndpointInfo = result.targetEndpointInfo; // 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,
serverDisplayName: '',
serverName: '',
databaseName: '',
ownerUri: '',
packageFilePath: result.targetEndpointInfo.packageFilePath,
connectionDetails: undefined
};
} }
this.updateSourceAndTarget(); this.updateSourceAndTarget();