$root = Split-Path -Parent $PSScriptRoot $dst = Join-Path $root 'data\mysql-init\01-j7508239_tracker.sql' if (-not (Test-Path -LiteralPath $dst)) { Write-Error "Not found: $dst. Run extract-tracker-db.ps1 first." exit 1 } $utf8 = New-Object System.Text.UTF8Encoding $false $t = [System.IO.File]::ReadAllText($dst, $utf8) $x = [regex]::Replace( $t, '`msPortalSection_data`\s+text(\s+COLLATE)', '`msPortalSection_data` mediumtext$1', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase ) if ($t -ceq $x) { Write-Host "No change (already MEDIUMTEXT or CREATE not found)." exit 0 } [System.IO.File]::WriteAllText($dst, $x, $utf8) Write-Host ('Patched msPortalSection_data in ' + $dst)