Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set target platform for database project from the server metadata #20558

Merged
merged 2 commits into from
Sep 9, 2022

Conversation

SakshiS-harma
Copy link
Contributor

@SakshiS-harma SakshiS-harma commented Sep 7, 2022

This PR fixes #20363.
Currently, all the database projects created from the databases are assigned DSP (target platform) as "Sql Server 2019". instead of its current version. The changes in PR reads the server metadata to determine its version and maps & assigns it appropriately to the target platform for the database project.
Steps to repro:

  1. Connect to DW server with a user db.
  2. Create project from this user db.
    -- The project should now be created with appropriate target platform.

This PR doesn't handle the VSCode version of Projects.

@coveralls
Copy link

coveralls commented Sep 7, 2022

Pull Request Test Coverage Report for Build 3011414857

  • 3 of 13 (23.08%) changed or added relevant lines in 4 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.007%) to 42.038%

Changes Missing Coverage Covered Lines Changed/Added Lines %
extensions/sql-database-projects/src/controllers/projectController.ts 0 2 0.0%
extensions/sql-database-projects/src/common/utils.ts 1 9 11.11%
Files with Coverage Reduction New Missed Lines %
extensions/sql-database-projects/src/controllers/projectController.ts 2 38.92%
Totals Coverage Status
Change from base Build 3010402115: -0.007%
Covered Lines: 28004
Relevant Lines: 62032

💛 - Coveralls

let targetPlatform;
if (isCloud) {
const engineEdition = serverInfo.engineEditionId;
targetPlatform = engineEdition === azdataType.DatabaseEngineEdition.SqlDataWarehouse ? SqlTargetPlatform.sqlDW : (engineEdition === azdataType.DatabaseEngineEdition.SqlDatabase ? SqlTargetPlatform.sqlAzure : undefined);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it isn't DW, can we just assume it's sqlAzure and skip the check if the engineEditoin is SqlDatabase?

Copy link
Contributor Author

@SakshiS-harma SakshiS-harma Sep 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Projects support Sql Edge as well (

). So I thought setting it to SQL Azure wouldn't be completely correct, hence the extra check. But if you think it should safe to skip the additional check, I can do that to.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be ok to set the target platform to sqlAzure if it's cloud and not DW. @Benjin any concerns with this? I don't think there are that many people creating projects from edge dbs, and the new edge project template creates projects with the target platform 150.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated it for now, waiting on Benjin for confirmation.

@SakshiS-harma
Copy link
Contributor Author

Created #20576 to track VS code version.

@SakshiS-harma SakshiS-harma merged commit a6920ca into main Sep 9, 2022
@SakshiS-harma SakshiS-harma deleted the sakshis/createProjectFromDbDSPFix branch September 9, 2022 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants