Combine project deploy settings into one (#16383)

This commit is contained in:
Charles Gagnon
2021-07-21 16:15:25 -07:00
committed by GitHub
parent 87633faaa4
commit c1f4c50177
6 changed files with 37 additions and 52 deletions

View File

@@ -10,7 +10,7 @@ import * as utils from '../common/utils';
import { Project } from '../models/project';
import { SqlConnectionDataSource } from '../models/dataSources/sqlConnectionStringSource';
import { IPublishSettings, IGenerateScriptSettings } from '../models/IPublishSettings';
import { IDeploySettings } from '../models/IDeploySettings';
import { DeploymentOptions, SchemaObjectType } from '../../../mssql/src/mssql';
import { IconPathHelper } from '../common/iconHelper';
import { cssStyles } from '../common/uiConstants';
@@ -46,8 +46,8 @@ export class PublishDatabaseDialog {
private toDispose: vscode.Disposable[] = [];
public publish: ((proj: Project, profile: IPublishSettings) => any) | undefined;
public generateScript: ((proj: Project, profile: IGenerateScriptSettings) => any) | undefined;
public publish: ((proj: Project, profile: IDeploySettings) => any) | undefined;
public generateScript: ((proj: Project, profile: IDeploySettings) => any) | undefined;
public readPublishProfile: ((profileUri: vscode.Uri) => any) | undefined;
constructor(private project: Project) {
@@ -182,10 +182,9 @@ export class PublishDatabaseDialog {
}
public async publishClick(): Promise<void> {
const settings: IPublishSettings = {
const settings: IDeploySettings = {
databaseName: this.getTargetDatabaseName(),
serverName: this.getServerName(),
upgradeExisting: true,
connectionUri: await this.getConnectionUri(),
sqlCmdVariables: this.getSqlCmdVariablesForPublish(),
deploymentOptions: await this.getDeploymentOptions(),
@@ -202,7 +201,7 @@ export class PublishDatabaseDialog {
TelemetryReporter.sendActionEvent(TelemetryViews.SqlProjectPublishDialog, TelemetryActions.generateScriptClicked);
const sqlCmdVars = this.getSqlCmdVariablesForPublish();
const settings: IGenerateScriptSettings = {
const settings: IDeploySettings = {
databaseName: this.getTargetDatabaseName(),
serverName: this.getServerName(),
connectionUri: await this.getConnectionUri(),
@@ -213,9 +212,7 @@ export class PublishDatabaseDialog {
utils.getAzdataApi()!.window.closeDialog(this.dialog);
if (this.generateScript) {
await this.generateScript!(this.project, settings);
}
await this.generateScript?.(this.project, settings);
this.dispose();
}

View File

@@ -5,7 +5,6 @@
import * as vscode from 'vscode';
import * as constants from '../common/constants';
import { IGenerateScriptSettings, IPublishSettings } from '../models/IPublishSettings';
import { Project } from '../models/project';
import { PublishProfile, readPublishProfile } from '../models/publishProfile/publishProfile';
import { promptForPublishProfile } from './publishDatabaseDialog';
@@ -188,17 +187,12 @@ export async function launchPublishDatabaseQuickpick(project: Project): Promise<
// TODO@chgagnon: Get deployment options
// 6. Generate script/publish
let settings: IPublishSettings | IGenerateScriptSettings = {
databaseName: databaseName,
serverName: '', // TODO@chgagnon: Get from connection profile
connectionUri: '', // TODO@chgagnon: Get from connection profile
sqlCmdVariables: undefined, // this.getSqlCmdVariablesForPublish(),
deploymentOptions: undefined, // await this.getDeploymentOptions(),
profileUsed: true, // this.profileUsed,
};
// TODO@chgagnon Consolidate creation of the settings into one place
if (action === constants.publish) {
(settings as IPublishSettings).upgradeExisting = true;
}
// let settings: IDeploySettings | IGenerateScriptSettings = {
// databaseName: databaseName,
// serverName: connectionProfile!.server,
// connectionUri: '', // TODO@chgagnon: Get from connection profile
// sqlCmdVariables: sqlCmdVariables,
// deploymentOptions: undefined, // await this.getDeploymentOptions(),
// profileUsed: !!publishProfile
// };
}