mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 17:43:12 +00:00
23 lines
688 B
PowerShell
23 lines
688 B
PowerShell
# Backfill DocStatus from legacy SignOffAttachment (idempotent)
|
|
# Run against target SQL Server after Phase6_CompletionSlideOver migration.
|
|
|
|
param(
|
|
[string]$ConnectionString = $env:ConnectionStrings__DefaultConnection
|
|
)
|
|
|
|
if ([string]::IsNullOrWhiteSpace($ConnectionString)) {
|
|
Write-Error "Set ConnectionStrings__DefaultConnection or pass -ConnectionString"
|
|
exit 1
|
|
}
|
|
|
|
$sql = @"
|
|
UPDATE workOrders
|
|
SET DocStatus = 1
|
|
WHERE DocStatus IS NULL
|
|
AND SignOffAttachment IS NOT NULL
|
|
AND LTRIM(RTRIM(SignOffAttachment)) <> '';
|
|
"@
|
|
|
|
Write-Host "Backfilling DocStatus=Yes where SignOffAttachment exists..."
|
|
Invoke-Sqlcmd -ConnectionString $ConnectionString -Query $sql
|
|
Write-Host "Done."
|