Additional SQL Proj cleanup (#19836)

This commit is contained in:
Charles Gagnon
2022-06-27 17:29:49 -07:00
committed by GitHub
parent 5dea50efa3
commit 87f8f2fd90
10 changed files with 75 additions and 66 deletions

View File

@@ -14,7 +14,7 @@ import * as path from 'path';
import * as fse from 'fs-extra';
import { AzureSqlClient } from '../models/deploy/azureSqlClient';
import { IAccount } from 'vscode-mssql';
import { IDeploySettings, ILocalDbSetting, IPublishToDockerSettings, ISqlProject } from 'sqldbproj';
import { ISqlProjectPublishSettings, IDockerSettings, IPublishToDockerSettings, ISqlProject } from 'sqldbproj';
/**
* Create flow for Deploying a database using only VS Code-native APIs such as QuickPick
@@ -252,7 +252,7 @@ export async function launchCreateAzureServerQuickPick(project: Project, azureSq
return undefined;
}
let settings: IDeploySettings | undefined = await getPublishDatabaseSettings(project, false);
let settings: ISqlProjectPublishSettings | undefined = await getPublishDatabaseSettings(project, false);
return {
// TODO add tenant
@@ -278,7 +278,7 @@ export async function launchCreateAzureServerQuickPick(project: Project, azureSq
export async function getPublishToDockerSettings(project: ISqlProject): Promise<IPublishToDockerSettings | undefined> {
const target = project.getProjectTargetVersion();
const name = uiUtils.getPublishServerName(target);
let localDbSetting: ILocalDbSetting | undefined;
let localDbSetting: IDockerSettings | undefined;
// Deploy to docker selected
let portNumber = await vscode.window.showInputBox({
title: constants.enterPortNumber(name),
@@ -394,7 +394,7 @@ export async function getPublishToDockerSettings(project: ISqlProject): Promise<
localDbSetting.dbName = deploySettings.databaseName;
return {
localDbSetting: localDbSetting,
deploySettings: deploySettings,
dockerSettings: localDbSetting,
sqlProjectPublishSettings: deploySettings,
};
}

View File

@@ -17,7 +17,7 @@ import { getAgreementDisplayText, getConnectionName, getDockerBaseImages, getPub
import { TelemetryActions, TelemetryReporter, TelemetryViews } from '../common/telemetry';
import { Deferred } from '../common/promise';
import { PublishOptionsDialog } from './publishOptionsDialog';
import { IDeploySettings, IPublishToDockerSettings } from 'sqldbproj';
import { ISqlProjectPublishSettings, IPublishToDockerSettings } from 'sqldbproj';
interface DataSourceDropdownValue extends azdataType.CategoryValue {
dataSource: SqlConnectionDataSource;
@@ -63,9 +63,9 @@ export class PublishDatabaseDialog {
private toDispose: vscode.Disposable[] = [];
public publish: ((proj: Project, profile: IDeploySettings) => any) | undefined;
public publish: ((proj: Project, profile: ISqlProjectPublishSettings) => any) | undefined;
public publishToContainer: ((proj: Project, profile: IPublishToDockerSettings) => any) | undefined;
public generateScript: ((proj: Project, profile: IDeploySettings) => any) | undefined;
public generateScript: ((proj: Project, profile: ISqlProjectPublishSettings) => any) | undefined;
public readPublishProfile: ((profileUri: vscode.Uri) => any) | undefined;
constructor(private project: Project) {
@@ -224,7 +224,7 @@ export class PublishDatabaseDialog {
public async publishClick(): Promise<void> {
if (this.existingServerSelected) {
const settings: IDeploySettings = {
const settings: ISqlProjectPublishSettings = {
databaseName: this.targetDatabaseName,
serverName: this.getServerName(),
connectionUri: await this.getConnectionUri(),
@@ -240,7 +240,7 @@ export class PublishDatabaseDialog {
const baseImages = getDockerBaseImages(this.project.getProjectTargetVersion());
const imageInfo = baseImages.find(x => x.name === dockerBaseImage);
const settings: IPublishToDockerSettings = {
localDbSetting: {
dockerSettings: {
dbName: this.targetDatabaseName,
dockerBaseImage: dockerBaseImage,
dockerBaseImageEula: imageInfo?.agreementInfo?.link?.url || '',
@@ -249,7 +249,7 @@ export class PublishDatabaseDialog {
serverName: constants.defaultLocalServerName,
userName: constants.defaultLocalServerAdminName
},
deploySettings: {
sqlProjectPublishSettings: {
databaseName: this.targetDatabaseName,
serverName: constants.defaultLocalServerName,
connectionUri: '',
@@ -270,7 +270,7 @@ export class PublishDatabaseDialog {
TelemetryReporter.sendActionEvent(TelemetryViews.SqlProjectPublishDialog, TelemetryActions.generateScriptClicked);
const sqlCmdVars = this.getSqlCmdVariablesForPublish();
const settings: IDeploySettings = {
const settings: ISqlProjectPublishSettings = {
databaseName: this.targetDatabaseName,
serverName: this.getServerName(),
connectionUri: await this.getConnectionUri(),

View File

@@ -11,12 +11,12 @@ import { promptForPublishProfile } from './publishDatabaseDialog';
import { getDefaultPublishDeploymentOptions, getVscodeMssqlApi } from '../common/utils';
import { IConnectionInfo, IFireWallRuleError } from 'vscode-mssql';
import { getPublishServerName } from './utils';
import { IDeploySettings, ISqlProject, SqlTargetPlatform } from 'sqldbproj';
import { ISqlProjectPublishSettings, ISqlProject, SqlTargetPlatform } from 'sqldbproj';
/**
* Create flow for Publishing a database using only VS Code-native APIs such as QuickPick
*/
export async function getPublishDatabaseSettings(project: ISqlProject, promptForConnection: boolean = true): Promise<IDeploySettings | undefined> {
export async function getPublishDatabaseSettings(project: ISqlProject, promptForConnection: boolean = true): Promise<ISqlProjectPublishSettings | undefined> {
// 1. Select publish settings file (optional)
// Create custom quickpick so we can control stuff like displaying the loading indicator
@@ -207,7 +207,7 @@ export async function getPublishDatabaseSettings(project: ISqlProject, promptFor
}
// 6. Generate script/publish
let settings: IDeploySettings = {
let settings: ISqlProjectPublishSettings = {
databaseName: databaseName,
serverName: connectionProfile?.server || '',
connectionUri: connectionUri || '',