Open serenefiresiren opened 3 months ago
I could see a -Force
being implemented somewhere in here; though -AutoCreateTable
would insinuate a forcing of the schema creation. I could also see having -AutoCreateSchema
on Write-DbaDbTableData
to be extra -Verbose
.
Additionally, I would expect New-DbaDbTable
to fail if the schema doesn't exist and have a -Force
parameter or -AutoCreateSchema
.
Summarize Functionality
The New-Table function does not create a missing schema when AutoCreateTable is used. I believe this should match the functionality in the existing New-DbaDBTable which automatically creates a missing schema even if not the same way.
Is there a command that is similiar or close to what you are looking for?
Yes
Technical Details
Error Message:
Snippet from New-DbaDbTable line 464 for existing example.
The schema is already being parsed out at line 430, which appears to be done before
#region Test if table exists
is reached.I believe the check should be put within
#region Test if table exists
that starts at 506. A rough guess at how it may look.