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

New-DbaDbUser: Refactoring and bugfixing #9386

Merged
merged 10 commits into from
Jun 29, 2024

Conversation

andreasjordan
Copy link
Contributor

@andreasjordan andreasjordan commented Jun 8, 2024

Type of Change

  • Bug fix (non-breaking change, fixes New-DbaDbUser - Multiple -SqlInstance Without -Database Doesn't Add User To All Dbs #9340 )
  • New feature (non-breaking change, adds functionality, fixes # )
  • Breaking change (affects multiple commands or functionality, fixes # )
  • Ran manual Pester test and has passed (.\tests\manual.pester.ps1)
  • Adding code coverage to existing functionality
  • Pester test is included
  • If new file reference added for test, has is been added to github.com/dataplat/appveyor-lab ?
  • Unit test is included
  • Documentation
  • Build system

As I have to (re-)refactor this command a second time after the first refactoring in 2022, I want to do something new: Have a command with a lot of comments to tell other contributors how and why we do things.

I changed Stop-Function to support -WhatIf. Without that change, the variable is not set and Test-FunctionInterrupt does not work. Then, if the command fails in the begin block, the process block is still executed.

As I'm not a native english speaker, please correct all my mistakes in the new comments.

And there are some "Discussion" comments - which I would like to discuss.

@andreasjordan andreasjordan marked this pull request as ready for review June 9, 2024 12:42
Copy link
Contributor

@niphlod niphlod left a comment

Choose a reason for hiding this comment

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

Had time just to do a first round as an "editor", other things may pop up

public/New-DbaDbUser.ps1 Outdated Show resolved Hide resolved
public/New-DbaDbUser.ps1 Outdated Show resolved Hide resolved
public/New-DbaDbUser.ps1 Show resolved Hide resolved
public/New-DbaDbUser.ps1 Outdated Show resolved Hide resolved
public/New-DbaDbUser.ps1 Show resolved Hide resolved
public/New-DbaDbUser.ps1 Outdated Show resolved Hide resolved
public/New-DbaDbUser.ps1 Outdated Show resolved Hide resolved
public/New-DbaDbUser.ps1 Outdated Show resolved Hide resolved
public/New-DbaDbUser.ps1 Outdated Show resolved Hide resolved
@andreasjordan
Copy link
Contributor Author

Thanks @niphlod for the feedback, just fixed some typos.

One additional point: Pipeline Input. A lot of commands accept pipeline input, most other ...-DbaDb... commands accept database SMOs to be piped in. That would also be my recommendation. But I wanted to get feedback before changing the code.

@niphlod
Copy link
Contributor

niphlod commented Jun 10, 2024

on "the pipeline" ... I guess it has not been "declared" a sound/strict rationale behind it.
Prolly the author inserts it the way "it was envisioned" in the first place or it has been added as an additional request. I don't think we should "force" to have all the commands targeting dbs to accept a pipelined "list of smo dbs", nor "force" login-related parameters to accept a "list of smo logins", etc etc etc. tl;dr: I see it as a "nicety" (granted it makes sense for some kind of useful behaviour) rather than an "obligation" to adhere to.

@potatoqualitee
Copy link
Member

will merge once approved 👍🏼

@andreasjordan andreasjordan requested a review from niphlod June 16, 2024 11:15
@potatoqualitee
Copy link
Member

Hell yeah, love that approval. Thank you both so much 🙇🏼

@potatoqualitee potatoqualitee merged commit b0d2373 into development Jun 29, 2024
13 checks passed
@potatoqualitee potatoqualitee deleted the NewDbaDbUser_refactoring branch June 29, 2024 00:58
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.

New-DbaDbUser - Multiple -SqlInstance Without -Database Doesn't Add User To All Dbs
3 participants