Skip to content

Commit

Permalink
Start-DbaMigration - Remove KeepCDC and KeepReplication parameters fr…
Browse files Browse the repository at this point in the history
…om detach method (dataplat#8871)
  • Loading branch information
ben-thul authored Apr 19, 2023
1 parent ee73fc6 commit 056f494
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions public/Start-DbaMigration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,45 @@ function Start-DbaMigration {
if ($Exclude -notcontains 'Databases') {
Write-ProgressHelper -StepNumber ($stepCounter++) -Message "Migrating databases"
Write-Message -Level Verbose -Message "Migrating databases"

$CopyDatabaseSplat = @{
Source = $sourceserver
Destination = $Destination
DestinationSqlCredential = $DestinationSqlCredential
SetSourceReadOnly = $SetSourceReadOnly
ReuseSourceFolderStructure = $ReuseSourceFolderStructure
AllDatabases = $true
Force = $Force
IncludeSupportDbs = $IncludeSupportDbs
}

if ($BackupRestore) {
$CopyDatabaseSplat += @{
BackupRestore = $true
NoRecovery = $NoRecovery
WithReplace = $WithReplace
KeepCDC = $KeepCDC
KeepReplication = $KeepReplication
}
if ($UseLastBackup) {
Copy-DbaDatabase -Source $sourceserver -Destination $Destination -DestinationSqlCredential $DestinationSqlCredential -AllDatabases -SetSourceReadOnly:$SetSourceReadOnly -ReuseSourceFolderStructure:$ReuseSourceFolderStructure -BackupRestore -Force:$Force -NoRecovery:$NoRecovery -WithReplace:$WithReplace -IncludeSupportDbs:$IncludeSupportDbs -UseLastBackup:$UseLastBackup -Continue:$Continue -KeepCDC:$KeepCDC -KeepReplication:$KeepReplication
$CopyDatabaseSplat += @{
UseLastBackup = $UseLastBackup
Continue = $Continue
}
} else {
Copy-DbaDatabase -Source $sourceserver -Destination $Destination -DestinationSqlCredential $DestinationSqlCredential -AllDatabases -SetSourceReadOnly:$SetSourceReadOnly -ReuseSourceFolderStructure:$ReuseSourceFolderStructure -BackupRestore -SharedPath $SharedPath -Force:$Force -NoRecovery:$NoRecovery -WithReplace:$WithReplace -IncludeSupportDbs:$IncludeSupportDbs -AzureCredential $AzureCredential -KeepCDC:$KeepCDC -KeepReplication:$KeepReplication
$CopyDatabaseSplat += @{
SharedPath = $SharedPath
AzureCredential = $AzureCredential
}
}
} else {
Copy-DbaDatabase -Source $sourceserver -Destination $Destination -DestinationSqlCredential $DestinationSqlCredential -AllDatabases -SetSourceReadOnly:$SetSourceReadOnly -ReuseSourceFolderStructure:$ReuseSourceFolderStructure -DetachAttach:$DetachAttach -Reattach:$Reattach -Force:$Force -IncludeSupportDbs:$IncludeSupportDbs -KeepCDC:$KeepCDC -KeepReplication:$KeepReplication
$CopyDatabaseSplat += @{
DetachAttach = $DetachAttach
Reattach = $Reattach
}
}

Copy-DbaDatabase @CopyDatabaseSplat
}

if ($Exclude -notcontains 'Logins') {
Expand Down Expand Up @@ -476,4 +506,4 @@ function Start-DbaMigration {
Write-Message -Level Verbose -Message "Migration completed: $(Get-Date)"
Write-Message -Level Verbose -Message "Total Elapsed time: $totaltime"
}
}
}

0 comments on commit 056f494

Please sign in to comment.