فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
fix(a02): remove accidental duplicate PowerShell tail and restore exact SQL integration smoke parser
davoodmehraban89 committed
Oct 30, 2026 at 20:06 UTC
d626d69de28c2b0a961ee1a188bccf0c1847ceb4
1 file changed
-37
scripts/a02-synthetic-sql-localdb-restore-smoke.ps1
-37
@@ -142,40 +142,3 @@ try{
142
}
143
if([IO.Directory]::Exists($folder)){try{[IO.Directory]::Delete($folder,$true)}catch{}}
144
}
145
- -and
146
- $inventory.userRowsRead -eq $false -and
147
- $inventory.databaseModified -eq $false -and
148
- $inventory.canImport -eq $false) 'A02_SCHEMA_INVENTORY_CONTRACT_FAILED'
149
- $phase='synthetic-reconciliation'
150
- $row=QuerySql $conn ('SELECT COUNT_BIG(*) AS C,SUM(amount) AS T FROM ['+$restored+'].dbo.A02Synthetic;')
151
- Require ($row.Rows.Count -eq 1 -and [long]$row.Rows[0]['C'] -eq 2 -and
152
- [long]$row.Rows[0]['T'] -eq 80235) 'A02_RESTORED_SYNTHETIC_TOTALS_MISMATCH'
153
- [pscustomobject]@{
154
- status='synthetic-localdb-restore-verified';ownerBackupUsed=$false
155
- headerVerified=$true;fileListVerified=$true;verifyOnlyPassed=$true
156
- restoreExecuted=$true;dbccPassed=$true;syntheticRecords=2
157
- syntheticTotal=80235;financialMigrationPerformed=$false;canImport=$false
158
- }|ConvertTo-Json -Compress
159
-}catch{
160
- # Only a bounded phase and exception *type* are public; never emit raw SQL,
161
- # paths, backup bytes, identity, or exception messages.
162
- $kind=$_.Exception.GetType().Name
163
- Write-Error ('A02_SYNTHETIC_LOCALDB_RESTORE_FAILED phase='+$phase+' type='+$kind)
164
- exit 2
165
-}finally{
166
- if($null -ne $conn){
167
- try{
168
- foreach($name in @($restored,$source)){
169
- ExecSql $conn ('IF DB_ID('+(Literal $name)+') IS NOT NULL BEGIN '+
170
- 'ALTER DATABASE ['+$name+'] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; '+
171
- 'DROP DATABASE ['+$name+']; END;')
172
- }
173
- }catch{}
174
- $conn.Dispose()
175
- }
176
- if($created){
177
- try{& $localdb stop $instance -k | Out-Null}catch{}
178
- try{& $localdb delete $instance | Out-Null}catch{}
179
- }
180
- if([IO.Directory]::Exists($folder)){try{[IO.Directory]::Delete($folder,$true)}catch{}}
181
-}