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

Load profile support for sql project deploy #10948

Merged
merged 8 commits into from
Jun 19, 2020
Merged

Conversation

kisantia
Copy link
Contributor

@kisantia kisantia commented Jun 16, 2020

This PR fixes #10924. This adds support for reading database name and SQLCMD variables from a publish profile. Support for other profile options will be added in later PRs.
Screen Shot 2020-06-16 at 5 50 27 PM

Empty state (no profile loaded and no sqlcmdvars in the sqlproj):
Screen Shot 2020-06-17 at 9 57 54 AM

This also fixes #10947 so that the values of SQLCMD variables show and change if the profile has different values for them (support for editing them in the UI will come later).
loadProfile

@coveralls
Copy link

coveralls commented Jun 16, 2020

Coverage Status

Coverage decreased (-0.003%) to 35.024% when pulling 4a17248 on kisantia/profileSqlCmd into fb4e400 on main.


if (this.readPublishProfile) {
const result = await this.readPublishProfile(fileUris[0]);
(<azdata.InputBoxComponent>this.targetDatabaseTextBox).value = result.databaseName;
Copy link
Contributor

@udeeshagautam udeeshagautam Jun 19, 2020

Choose a reason for hiding this comment

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

is it possible that no db name is there? and in this that case can we keep showing the proj name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup in that case, the name will become empty since that's what SSDT does.

let targetDbName: string = '';
let targetDatabaseNameCount = profileXmlDoc.documentElement.getElementsByTagName(constants.targetDatabaseName).length;
if (targetDatabaseNameCount > 0) {
// if there is more than one TargetDatabaseName nodes, SSDT uses the name in the last one so we'll do the same here
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm.. good catch. Why are more than one db names allowed in SSDT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure. It's pretty strange :/

@kisantia kisantia merged commit 6ad33aa into main Jun 19, 2020
@kisantia kisantia deleted the kisantia/profileSqlCmd branch June 19, 2020 00:44
ktech99 pushed a commit that referenced this pull request Aug 23, 2020
* load database name from profile.xml

* load sqlcmd variables from profile

* Add warning text

* add tests

* fix file filter for windows

* add comments

* show SQLCMD variables in a table

* reset dialog before testing readPublishProfile callback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

show SQLCMD variables loaded from profile Basic profile.xml parsing for sql proj publish
4 participants