in src/commands.ts [80:119]
async function deployCurrentProject(args, commandObserver: CommandObserver, client: SqlOpsDataClient) {
let project = '';
if (!args) {
const activeEditor = vscode.window.activeTextEditor;
if (activeEditor !== undefined) {
project = activeEditor.document.uri.fsPath;
}
} else {
project = args.fsPath;
}
try {
await projectHelper.buildProjects([project], commandObserver).then(async result => {
if (result && !result.some(b => b.status === buildStatus.Failure || b.status === buildStatus.Skipped)) {
await projectHelper.setOutputFilePath(project, commandObserver);
var fileUri = vscode.Uri.file(commandObserver.outputFilePath);
if (fileUri.fsPath && fs.existsSync(fileUri.fsPath)) {
var connection = await azdata.connection.openConnectionDialog([Constants.providerId]);
if (connection) {
var filePath = fileUri.toString(true)
let projectFileText = fs.readFileSync(fileUri.fsPath, 'utf8');
azdata.queryeditor.connect(filePath, connection.connectionId).then(() => {
commandObserver.logToOutputChannel(localize('extension.deploymentStartedMessage', '\nDeployment started {0}.', new Date().toLocaleString()));
client.sendRequest("query/executeDeploy", {owner_uri: filePath, query:projectFileText})
.then(() => { }, err => {
commandObserver.logToOutputChannel(localize('extension.FailedDeploy', 'Deployment failed with error: {0}', err.message));
})
});
}
} else {
vscode.window.showErrorMessage(localize('extension.GetOutputPathFailed', 'Unable to find output file path to deploy.'));
}
} else {
vscode.window.showErrorMessage(localize('extension.deployBeginFailed', 'Deploy cannot begin until your project builds successfully.'));
}
})
} finally {
commandObserver.outputFilePath = "";
}
}