Start-DbaMigration - Add -SetSourceOffline to set databases offline during migration#10013
Merged
potatoqualitee merged 14 commits intodevelopmentfrom Dec 25, 2025
Merged
Conversation
…uring migration This enhances the -SetSourceOffline parameter to work like -SetSourceReadOnly, setting databases offline BEFORE migration begins (not after) to prevent any connections to source databases during the migration process. Changes: - Start-DbaMigration.ps1: Added parameter and documentation - Copy-DbaDatabase.ps1: Modified to set offline before migration, online on destination - Tests updated to include new parameter in validation (do Start-DbaMigration, Copy-DbaDatabase) Co-authored-by: Chrissy LeMaire <[email protected]>
Member
Author
|
@claude add an integration test |
…eter (do Start-DbaMigration) Co-authored-by: Chrissy LeMaire <[email protected]>
(do Start-DbaMigration) Co-authored-by: Chrissy LeMaire <[email protected]>
… verification (do Start-DbaMigration) Co-authored-by: Chrissy LeMaire <[email protected]>
Updated the role filtering logic in Copy-DbaServerRole to exclude the 'public' role in addition to fixed roles. This prevents unintended copying of the 'public' role to the target server.
Enhanced test setup and cleanup to handle offline databases and cross-platform backup paths. Added robust cleanup using T-SQL, improved backup directory handling for Linux/Docker, and refactored tests to ensure accurate migration and status checks. Also updated exclusions and variable usage for clarity and reliability.
SetSourceOffline is now applied before detach for DetachAttach and after backup for BackupRestore to ensure proper connection handling. Added integration tests to verify offline state after migration and cleanup logic for offline databases. (do Start-DbaMigration)
Always use SQL Server's default backup directory for backups in Start-DbaMigration integration tests, removing OS-specific logic and cleanup. This ensures consistent access permissions and simplifies test setup and teardown.
Introduces removal of backup files created during Start-DbaMigration integration tests to ensure a cleaner test environment and prevent leftover files from affecting subsequent test runs. (do Start-DbaMigration, Copy-DbaDatabase)
Reset Start-DbaMigration.Tests.ps1 and Copy-DbaDatabase.Tests.ps1 to their development branch versions to establish a clean baseline before adding new tests for SetSourceOffline parameter. (do Start-DbaMigration, Copy-DbaDatabase)
Add integration tests to verify: - Source database is set offline after successful migration - Destination database is online/normal after migration (do Start-DbaMigration)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enhances the -SetSourceOffline parameter to work like -SetSourceReadOnly, setting databases offline BEFORE migration begins (not after) to prevent any connections to source databases during the migration process.
Closes #9156
Generated with Claude Code