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

Install-DbaMaintenanceSolution - don't drop tables if not readding #9570

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

jpomfret
Copy link
Collaborator

@jpomfret jpomfret commented Jan 6, 2025

Type of Change

Purpose

Reported in #9553 the CommandLog table is always dropped when ReplaceExisting is specified - this is causing issues if the SPs are calling the LogToTable parameter.

Approach

This change provides more control - the tables will only be dropped if the switches that use them are specified. This way if you want to keep the history in the CommandLog table but update the SPs you can.

I implemented the same logic for the InstallParallel parameter - and the Queue* tables - if the parameter is specified they will be dropped, if not they will remain on the server.

Commands to test

This will drop and replace all the SPs but none of the tables.

$paramHash = @{
  SqlInstance      = $svr
   Database        = 'Maint'
   SqlCredential   = $someCred
   Verbose         = $True
   ReplaceExisting = $True
}
Install-DbaMaintenanceSolution @paramHash

This will drop and replace the SPs and the CommandLog table

$paramHash = @{
  SqlInstance      = $svr
   Database        = 'Maint'
   SqlCredential   = $someCred
   Verbose         = $True
   ReplaceExisting = $True
   LogToTable = $True
}
Install-DbaMaintenanceSolution @paramHash

This will drop and create SPs and all tables.

$paramHash = @{
  SqlInstance      = $svr
   Database        = 'Maint'
   SqlCredential   = $someCred
   Verbose         = $True
   ReplaceExisting = $True
   LogToTable = $True
   InstallParallel = $True
}
Install-DbaMaintenanceSolution @paramHash

@potatoqualitee
Copy link
Member

Merci 🙏🏼

@potatoqualitee potatoqualitee merged commit f5e587f into dataplat:development Jan 8, 2025
3 checks passed
@potatoqualitee
Copy link
Member

bon 🤩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants