Skip to content

Commit 5cc3cbb

Browse files
Copy-DbaDbTableData - Fix missing Copy-DbaDbViewData scripting option passthrough (review of #10317)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d2d0ccc commit 5cc3cbb

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

docs/trackers/features/commit-bug-review-TRACKER.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Find real bugs (logic errors, null refs, incorrect behavior) and fix them. Skip
135135
| eddfeeeca | Find-DbaInstance - Fix TcpConnected false for default instances (#10327) | DONE | Added fallback port scanning for Browser default instances without reusing named-instance ports; added unit regression test. |
136136
| 5f483d42c | Get-DbaPermission - Fix Azure SQL DB compatibility (#10320) | DONE | Reviewed Azure SQL DB compatibility fix; no bugs found. |
137137
| a38bc6b35 | Get-DbaDbIdentity, Set-DbaDbIdentity, Invoke-DbaDbDbccUpdateUsage - Normalize table names (#10318) | DONE | Fixed escaped-bracket table name regression and added unit regression tests. |
138-
| 9899bd274 | Copy-DbaDbTableData - Add -ScriptingOptionsObject parameter (#10317) | PENDING | |
138+
| 9899bd274 | Copy-DbaDbTableData - Add -ScriptingOptionsObject parameter (#10317) | DONE | Propagated ScriptingOptionsObject to Copy-DbaDbViewData and added unit coverage. |
139139
| 0c486b964 | Backup-DbaDbCertificate: Don't use decryption password if cert encrypted by master key (#10329) | PENDING | |
140140
| db77a3476 | Find-DbaObject - Add unified command to search database objects by name (#10321) | PENDING | |
141141
| 6416b4e91 | Add Compare-DbaLogin command (#10319) | PENDING | |

public/Copy-DbaDbViewData.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ function Copy-DbaDbViewData {
5151
Automatically creates the destination table if it doesn't exist, using the same structure as the source view.
5252
Essential for initial data migrations or when materializing view data into new tables where destination tables haven't been created yet.
5353
54+
.PARAMETER ScriptingOptionsObject
55+
A scripting options object created by New-DbaScriptingOption that controls how the destination table is scripted when -AutoCreateTable is used.
56+
Use this to control which table properties are included in the CREATE TABLE script, such as indexes, constraints, triggers, and extended properties.
57+
5458
.PARAMETER BatchSize
5559
Number of rows to process in each bulk copy batch. Defaults to 50000 rows.
5660
Reduce this value for memory-constrained systems or increase it for faster transfers when copying large view result sets with sufficient memory.
@@ -216,6 +220,7 @@ function Copy-DbaDbViewData {
216220
[switch]$KeepNulls,
217221
[switch]$Truncate,
218222
[int]$BulkCopyTimeOut = 5000,
223+
[Microsoft.SqlServer.Management.Smo.ScriptingOptions]$ScriptingOptionsObject,
219224
[Parameter(ValueFromPipeline)]
220225
[Microsoft.SqlServer.Management.Smo.TableViewBase[]]$InputObject,
221226
[switch]$EnableException

tests/Copy-DbaDbViewData.Tests.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Requires -Module @{ ModuleName="Pester"; ModuleVersion="5.0" }
22
param(
3-
$ModuleName = "dbatools",
3+
$ModuleName = "dbatools",
44
$CommandName = "Copy-DbaDbViewData",
55
$PSDefaultParameterValues = $TestConfig.Defaults
66
)
@@ -30,6 +30,7 @@ Describe $CommandName -Tag UnitTests {
3030
"Query",
3131
"SqlCredential",
3232
"SqlInstance",
33+
"ScriptingOptionsObject",
3334
"Truncate",
3435
"View"
3536
)

0 commit comments

Comments
 (0)