Set target platform for db projects from server metadata: mssql vscode extension (#20607)

* Set target platform for mssql vscode extension- create project from db feature

* Addressed comments

* Address comment to add EngineEdition information in vscode-mssql.d.ts
This commit is contained in:
Sakshi Sharma
2022-09-19 10:50:55 -07:00
committed by GitHub
parent 76115dba1d
commit c6f3996ec7
5 changed files with 100 additions and 10 deletions

View File

@@ -1420,7 +1420,7 @@ export class ProjectsController {
}
const model = await createNewProjectFromDatabaseWithQuickpick(profile as mssqlVscode.IConnectionInfo);
if (model) {
await this.createProjectFromDatabaseCallback(model);
await this.createProjectFromDatabaseCallback(model, profile as mssqlVscode.IConnectionInfo);
}
return undefined;
}
@@ -1431,13 +1431,22 @@ export class ProjectsController {
return new CreateProjectFromDatabaseDialog(profile);
}
public async createProjectFromDatabaseCallback(model: ImportDataModel, connectionId?: string) {
public async createProjectFromDatabaseCallback(model: ImportDataModel, connectionInfo?: string | mssqlVscode.IConnectionInfo) {
try {
const newProjFolderUri = model.filePath;
let targetPlatform: SqlTargetPlatform | undefined;
if (connectionId) {
targetPlatform = await utils.getTargetPlatformFromServerVersion(connectionId);
let serverInfo;
if (connectionInfo) {
if (typeof connectionInfo === 'string') {
serverInfo = await utils.getAzdataApi()!.connection.getServerInfo(connectionInfo);
} else {
serverInfo = (await utils.getVscodeMssqlApi()).getServerInfo(connectionInfo);
}
}
if (serverInfo) {
targetPlatform = await utils.getTargetPlatformFromServerVersion(serverInfo);
}
const newProjFilePath = await this.createNewProject({