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

Backup-DbaDatabase : add a new switch parameter "NoAppendDbNameInPath" to prevent dbname systematically appended at the end of backup path #9348

Merged
merged 3 commits into from
May 16, 2024

Conversation

rferraton
Copy link
Contributor

Type of Change

  • Bug fix (non-breaking change, fixes # )
  • 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

Purpose

  1. Avoid to force the directory path to finish with the dbname whereas the path can be variabilized with -ReplaceInName and dbname token
  2. When the dbname is long the directory path length limit (259 characters) imposed by MSSQL Engine can be reach very easily when dbname is used twice in the path
  3. To allow to stick with Ola Hallengren default backup path
  4. Solve feature request #9346

Approach

Add a new switch variable that will avoid breaking changes to existing backup scripts using Backup-DbaDatabase but will allow to prevent the dbname to be systematicaly added at the end of the path

Commands to test

Backup-DbaDatabase -SqlInstance localhost -Database TESTDATABASE_ABC_1eed02d4-f58b-4110-9cee-78c2fa65123a_123456789012345678901234567890 -Type Full -CompressBackup -Checksum -Verify -FileCount 1 -Path "D:\MSSQL\BACKUPS\servername\instancename\dbname\backuptype" -FilePath "servername_dbname_backuptype_timestamp.bak" -TimeStampFormat "yyyyMMdd_HHmm" -ReplaceInName -CreateFolder -WarningVariable WarningVariable -OutVariable BackupResults -EnableException -NoAppendDbNameInPath

Screenshots

2024-05-13_15h04_34

@rferraton rferraton changed the title Backup-DbaDatabase add a new switc parameter NoAppendDbNameInPath to prevent dbname systematically appended at the end of backup path Backup-DbaDatabase : add a new switch parameter "NoAppendDbNameInPath" to prevent dbname systematically appended at the end of backup path May 13, 2024
@wsmelton
Copy link
Member

wsmelton commented May 13, 2024

Why is this needed? I don't see any issue linking the feature being requested. If we are not going to do an issue please expand on the scenarios (multiple are needed) this is meeting to address (these must be what we built tests on for the command).

@wsmelton
Copy link
Member

breaking changes to existing backup scripts

Who's backup scripts?

@rferraton
Copy link
Contributor Author

rferraton commented May 13, 2024

breaking changes to existing backup scripts

Who's backup scripts?

I mean that the new parameter NoAppendDbNameInPath , is not activate by default. If it was, it would lead to a behavior change and would impact backup directories output (in all currently used backup scripts using Backup-DbaDatabase over the world).

Using such a switch parameter allow to avoid breaking change because it will prevent the dbname to be added at the end of the backup path only when used ==> no breaking change.

I closed the issue #9341 that i opened a couple of days ago to signal a problem when dbname is long because niphlod say that is was more an enhancement request.

So i did the enhancement request #9346, made the enhancement, and push it.

@potatoqualitee
Copy link
Member

Thank you, @rferraton. This is a nice solution. @niphlod can you give approval? I will merge upon approval from core team.

@niphlod
Copy link
Contributor

niphlod commented May 14, 2024

looks good, may be a niche case, and would probably benefit from a specific test to make sure no regressions are introduced.

@potatoqualitee potatoqualitee merged commit 0fd8aa0 into dataplat:development May 16, 2024
3 checks passed
@potatoqualitee
Copy link
Member

merci 🇮🇹 😊

@rferraton
Copy link
Contributor Author

Thanks/Merci !

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.

None yet

4 participants