Open schema compare script (#5515)

* don't prompt for script file name anymore

* bump sqltoolsservice version so the generated script gets opened
This commit is contained in:
kisantia
2019-05-21 10:30:18 -07:00
committed by GitHub
parent 77413ad25c
commit c84367e2ee
8 changed files with 12 additions and 31 deletions

View File

@@ -336,27 +336,8 @@ export class SchemaCompareResult {
}).component();
this.generateScriptButton.onDidClick(async (click) => {
// generate default filename
let now = new Date();
let datetime = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate() + '-' + now.getHours() + '-' + now.getMinutes() + '-' + now.getSeconds();
let defaultFileName = `${this.targetName}_Update_${datetime}.sql`;
let fileUri = await vscode.window.showSaveDialog(
{
defaultUri: vscode.Uri.file(defaultFileName),
saveLabel: localize('schemaCompare.saveFile', 'Save'),
filters: {
'SQL Files': ['sql'],
}
}
);
if (!fileUri) {
return;
}
let service = await SchemaCompareResult.getService('MSSQL');
let result = await service.schemaCompareGenerateScript(this.comparisonResult.operationId, this.targetEndpointInfo.databaseName, fileUri.fsPath, azdata.TaskExecutionMode.execute);
let result = await service.schemaCompareGenerateScript(this.comparisonResult.operationId, this.targetEndpointInfo.serverName, this.targetEndpointInfo.databaseName, azdata.TaskExecutionMode.script);
if (!result || !result.success) {
vscode.window.showErrorMessage(
localize('schemaCompare.generateScriptErrorMessage', "Generate script failed: '{0}'", (result && result.errorMessage) ? result.errorMessage : 'Unknown'));