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

Fix: sql mi fixes #153

Merged
merged 5 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelogs/fragments/additional_sql_mi_fixes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bugfixes:
- Removed default value for UseDestinationDefaultDirectories to fix compatability with SQL MI (https://github.com/lowlydba/lowlydba.sqlserver/pull/153)
- Removed default value for KeepCDC to fix compatability with SQL MI (https://github.com/lowlydba/lowlydba.sqlserver/pull/153)
- Added missing mapping for UseDestinationDefaultDirectories (https://github.com/lowlydba/lowlydba.sqlserver/pull/153)
12 changes: 9 additions & 3 deletions plugins/modules/restore.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ $spec = @{
maintenance_solution_backup = @{type = 'bool'; required = $false; default = $false }
ignore_log_backup = @{type = 'bool'; required = $false; default = $false }
ignore_diff_backup = @{type = 'bool'; required = $false; default = $false }
use_destination_default_directories = @{type = 'bool'; required = $false; default = $false }
use_destination_default_directories = @{type = 'bool'; required = $false }
reuse_source_folder_structure = @{type = 'bool'; required = $false }
destination_file_prefix = @{type = 'str'; required = $false }
restored_database_name_prefix = @{type = 'str'; required = $false }
directory_recurse = @{type = 'bool'; required = $false; default = $false }
standby_directory = @{type = 'str'; required = $false }
replace_db_name_in_file = @{type = 'bool'; required = $false }
destination_file_suffix = @{type = 'str'; required = $false }
keep_cdc = @{type = 'bool'; required = $false; default = $false }
keep_cdc = @{type = 'bool'; required = $false }
stop_before = @{type = 'bool'; required = $false; default = $false }
stop_mark = @{type = 'str'; required = $false }
stop_after_date = @{type = 'str'; required = $false }
Expand Down Expand Up @@ -63,6 +63,7 @@ $verifyOnly = $module.Params.verify_only
$maintenanceSolutionBackup = $module.Params.maintenance_solution_backup
$ignoreLogBackup = $module.Params.ignore_log_backup
$ignoreDiffBackup = $module.Params.ignore_diff_backup
$useDestinationDefaultDirectories = $module.Params.use_destination_default_directories
$reuseSourceFolderStructure = $module.Params.reuse_source_folder_structure
$destinationFilePrefix = $module.Params.destination_file_prefix
$restoredDatabaseNamePrefix = $module.Params.restored_database_name_prefix
Expand Down Expand Up @@ -96,7 +97,6 @@ try {
IgnoreLogBackup = $ignoreLogBackup
IgnoreDiffBackup = $ignoreDiffBackup
DirectoryRecurse = $directoryRecurse
KeepCDC = $keepCDC
StopBefore = $stopBefore
NoRecovery = $noRecovery
MaxTransferSize = $maxTransferSize
Expand Down Expand Up @@ -150,6 +150,12 @@ try {
if ($null -ne $replaceDbNameInFile) {
$restoreSplat.Add("replaceDbNameInFile", $replaceDbNameInFile)
}
if ($null -ne $useDestinationDefaultDirectories) {
$restoreSplat.Add("useDestinationDefaultDirectories", $useDestinationDefaultDirectories)
}
if ($null -ne $keepCDC) {
$restoreSplat.Add("KeepCDC", $keepCDC)
}
$output = Restore-DbaDatabase @restoreSplat

if ($null -ne $output) {
Expand Down
2 changes: 0 additions & 2 deletions plugins/modules/restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
- If they don't exist, the function will try to create them.
type: bool
required: false
default: false
reuse_source_folder_structure:
description:
- By default, databases will be migrated to the destination Sql Server's default data and log directories.
Expand Down Expand Up @@ -149,7 +148,6 @@
- Indicates whether CDC information should be restored as part of the database.
type: bool
required: false
default: false
stop_before:
description:
- Switch to indicate the restore should stop before I(stop_mark) occurs, default is to stop when mark is created.
Expand Down