优化
This commit is contained in:
@@ -11,8 +11,8 @@ $ErrorActionPreference = 'Stop'
|
||||
$Repo = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
||||
$Workspace = (Resolve-Path (Join-Path $Repo '..')).Path
|
||||
$Acceptance = Join-Path $Workspace '.codex-tmp\p23-04-acceptance'
|
||||
$ExpectedSha256 = 'E86BB8DE105E9B59736FFCD180CBA902F2E3F5032C7EFF2E3DC3B24B289360A0'
|
||||
$ExpectedLines = 7803
|
||||
$ExpectedSha256 = '03234DF522426213FA64768FDF35182DC315F2E358E5FD993AA24A2E99936D63'
|
||||
$ExpectedLines = 13775
|
||||
|
||||
if ($TargetHost -notin @('127.0.0.1', 'localhost')) {
|
||||
[Console]::Error.WriteLine('Refusing non-local database; only 127.0.0.1 or localhost is allowed.')
|
||||
@@ -32,6 +32,25 @@ if ($actual -ne $ExpectedSha256 -or $lines -ne $ExpectedLines) {
|
||||
[Console]::Error.WriteLine("Unified SQL snapshot mismatch: $actual/$lines")
|
||||
exit 2
|
||||
}
|
||||
$sqlText = [System.IO.File]::ReadAllText($InputPath)
|
||||
$commentGateTokens = @(
|
||||
'CREATE PROCEDURE queue_column_comment',
|
||||
'CREATE PROCEDURE apply_one_table_comments',
|
||||
'CALL apply_queued_comments();',
|
||||
'字段注释批量升级改变了结构签名',
|
||||
'存在缺失中文注释的业务表',
|
||||
'存在缺失中文注释的业务字段'
|
||||
)
|
||||
foreach ($token in $commentGateTokens) {
|
||||
if (-not $sqlText.Contains($token)) {
|
||||
[Console]::Error.WriteLine("Unified SQL comment acceptance marker missing: $token")
|
||||
exit 2
|
||||
}
|
||||
}
|
||||
if ([regex]::Matches($sqlText, "SELECT 'PASS' AS migration_status").Count -ne 1) {
|
||||
[Console]::Error.WriteLine('Unified SQL must contain exactly one final PASS statement')
|
||||
exit 2
|
||||
}
|
||||
|
||||
$sequence = @(
|
||||
'empty: base.sql', 'replay: base.sql + input.sql + input.sql',
|
||||
@@ -40,11 +59,20 @@ $sequence = @(
|
||||
'overseas-missing-objects: fixture-overseas-missing-objects.sql',
|
||||
'interrupted-recovery: fixture-interrupted.sql', 'final-structure: verify-final.sql')
|
||||
Write-Output "SQL SHA-256: $actual / lines: $lines"
|
||||
Write-Output 'Comment gate: queued validation, per-table ALTER, signature verification, nine-schema coverage, unique PASS'
|
||||
Write-Output "Target: $TargetHost`:$Port"
|
||||
Write-Output 'Fixture order:'
|
||||
$sequence | ForEach-Object { Write-Output " $_" }
|
||||
if ($DryRun) { Write-Output 'DRY-RUN PASS (mysql not started; no database writes)'; exit 0 }
|
||||
|
||||
$acceptanceInput = Join-Path $Acceptance 'input.sql'
|
||||
Copy-Item -LiteralPath $InputPath -Destination $acceptanceInput -Force
|
||||
$stagedHash = ((Get-FileHash -Algorithm SHA256 -LiteralPath $acceptanceInput).Hash).Trim().ToUpperInvariant()
|
||||
if ($stagedHash -ne $actual) {
|
||||
[Console]::Error.WriteLine("Failed to stage the validated unified SQL snapshot: $stagedHash")
|
||||
exit 2
|
||||
}
|
||||
|
||||
$run = 0
|
||||
function Invoke-Stage([string]$Name, [string]$File) {
|
||||
$script = Join-Path $Acceptance $File
|
||||
|
||||
Reference in New Issue
Block a user