| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- # Run Wx SOP TenantUpgrade on test tenant (JDBC, same SQL as TenantUpgradeService)
- # Usage:
- # cd d:\ylrz_saas_new\java\scripts
- # .\run_wx_sop_tenant_upgrade.ps1
- # .\run_wx_sop_tenant_upgrade.ps1 -TenantDb ylrz_saas_tenant_1 -ToVersion V20260614_04
- param(
- [string]$TenantDb = "ylrz_saas_tenant_1",
- [long]$TenantId = 32,
- [string]$FromVersion = "",
- [string]$ToVersion = "V20260614_04",
- [string]$ApiBase = "http://127.0.0.1:8004",
- [switch]$UseApi
- )
- $ErrorActionPreference = "Stop"
- $scriptDir = $PSScriptRoot
- $javaHome = if ($env:JAVA_HOME) { $env:JAVA_HOME } else { "D:\AICALL\jdk-17.0.12+7" }
- $java = Join-Path $javaHome "bin\java.exe"
- Write-Host "=== Wx SOP TenantUpgrade ===" -ForegroundColor Cyan
- Write-Host "TenantId=$TenantId TenantDb=$TenantDb ToVersion=$ToVersion"
- if ($UseApi) {
- Write-Host "API mode not fully automated (captcha). Use JDBC mode." -ForegroundColor Yellow
- }
- Push-Location (Join-Path $scriptDir "..")
- try {
- $cpFile = Join-Path $scriptDir "tenant_upgrade_cp.txt"
- & mvn -q -pl fs-saas-admin dependency:build-classpath "-Dmdep.outputFile=$cpFile" 2>&1 | Out-Null
- if (-not (Test-Path $cpFile)) { throw "Failed to build classpath" }
- $cp = Get-Content $cpFile -Raw
- $src = Join-Path $scriptDir "RunTenantUpgrade.java"
- $outDir = Join-Path $scriptDir "out"
- New-Item -ItemType Directory -Force -Path $outDir | Out-Null
- & javac -encoding UTF-8 -cp $cp -d $outDir $src
- if ($LASTEXITCODE -ne 0) { throw "javac failed" }
- $fromArg = if ([string]::IsNullOrWhiteSpace($FromVersion)) { '""' } else { $FromVersion }
- & $java -cp "$outDir;$cp" RunTenantUpgrade $TenantDb $fromArg $ToVersion
- if ($LASTEXITCODE -ne 0) { throw "RunTenantUpgrade failed exit=$LASTEXITCODE" }
- } finally {
- Pop-Location
- }
- Write-Host ""
- Write-Host "Done. Re-login saas-adminui (test001) to refresh menus." -ForegroundColor Green
|