数据库升级版本优化

This commit is contained in:
Weiming committed 2026-12-02 15:06:48 +08:00
1 parent f44594d213
commit debea9bb36
49 files changed
+5937 -714

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
param(
[string]$JdbcUrl,
[string]$User,
[string]$Manifest = (Join-Path $PSScriptRoot "..\migrations\mysql\migration-manifest.txt"),
[string]$PasswordEnv = "DB_PASSWORD",
[string]$RehearsalSchema,
[ValidateSet("apply", "preflight", "dry-run")][string]$Mode = "preflight",
[ValidateRange(0, 3600)][int]$LockTimeoutSeconds = 60
)
$ErrorActionPreference = "Stop"
$backend = (Resolve-Path (Join-Path $PSScriptRoot "..\..\financial_system_backend")).Path
$manifestPath = (Resolve-Path $Manifest).Path
$classpathFile = Join-Path $backend "target\migration-classpath.txt"
if ($Mode -ne "dry-run" -and ([string]::IsNullOrWhiteSpace($JdbcUrl) -or [string]::IsNullOrWhiteSpace($User))) {
throw "MIGRATION_CONNECTION_ARGUMENTS_REQUIRED"
}
if ($Mode -eq "dry-run" -and -not [string]::IsNullOrWhiteSpace($RehearsalSchema)) {
throw "MIGRATION_REHEARSAL_MODE_INVALID"
}
Push-Location $backend
try {
& mvn.cmd -o -q -DskipTests compile dependency:build-classpath "-Dmdep.outputFile=$classpathFile"
if ($LASTEXITCODE -ne 0) { throw "MIGRATION_RUNNER_BUILD_FAILED" }
$dependencyClasspath = Get-Content -Raw $classpathFile
$classpath = (Join-Path $backend "target\classes") + ";" + $dependencyClasspath.Trim()
$arguments = @(
"-cp", $classpath,
"com.finance.system.migration.MySqlMigrationRunner",
"--manifest=$manifestPath",
"--mode=$Mode",
"--lock-timeout-seconds=$LockTimeoutSeconds"
)
if ($Mode -ne "dry-run") {
$arguments += "--url=$JdbcUrl"
$arguments += "--user=$User"
$arguments += "--password-env=$PasswordEnv"
if (-not [string]::IsNullOrWhiteSpace($RehearsalSchema)) {
$arguments += "--rehearsal-schema=$RehearsalSchema"
}
}
& java @arguments
if ($LASTEXITCODE -ne 0) { throw "MIGRATION_RUNNER_FAILED" }
} finally {
Pop-Location
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.