Database projects deploy (#10417)

* Hooking up deployment of SQL projects to the project build functionality and database selection UI
* Adding ADS-side plumbing for sqlcmdvars
This commit is contained in:
Benjin Dubishar
2020-05-26 14:28:09 -07:00
committed by GitHub
parent 690e3c582c
commit f0d86f8acb
14 changed files with 340 additions and 88 deletions

View File

@@ -0,0 +1,17 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export interface IDeploymentProfile {
databaseName: string;
connectionUri: string;
upgradeExisting: boolean;
sqlCmdVariables?: Record<string, string>;
}
export interface IGenerateScriptProfile {
databaseName: string;
connectionUri: string;
sqlCmdVariables?: Record<string, string>;
}

View File

@@ -25,6 +25,27 @@ export class SqlConnectionDataSource extends DataSource {
return constants.sqlConnectionStringFriendly;
}
public get server(): string {
return this.getSetting(constants.dataSourceSetting);
}
public get database(): string {
return this.getSetting(constants.initialCatalogSetting);
}
public get integratedSecurity(): boolean {
return this.getSetting(constants.integratedSecuritySetting).toLowerCase() === 'true';
}
public get username(): string {
return this.getSetting(constants.userIdSetting);
}
public get password(): string {
// TODO: secure password storage; https://github.com/microsoft/azuredatastudio/issues/10561
return this.getSetting(constants.passwordSetting);
}
constructor(name: string, connectionString: string) {
super(name);
@@ -38,12 +59,12 @@ export class SqlConnectionDataSource extends DataSource {
throw new Error(constants.invalidSqlConnectionString);
}
this.connectionStringComponents[split[0]] = split[1];
this.connectionStringComponents[split[0].toLocaleLowerCase()] = split[1];
}
}
public getSetting(settingName: string): string {
return this.connectionStringComponents[settingName];
return this.connectionStringComponents[settingName.toLocaleLowerCase()];
}
public static fromJson(json: DataSourceJson): SqlConnectionDataSource {

View File

@@ -19,6 +19,7 @@ export class Project {
public projectFileName: string;
public files: ProjectEntry[] = [];
public dataSources: DataSource[] = [];
public sqlCmdVariables: Record<string, string> = {};
public get projectFolderPath() {
return path.dirname(this.projectFilePath);