接入Salon Flyway空库迁移并校验自动发布包
This commit is contained in:
@@ -159,6 +159,29 @@ function Get-RelationshipId {
|
||||
return ""
|
||||
}
|
||||
|
||||
function Assert-FlywayMigrationPackaged {
|
||||
param([string]$Path)
|
||||
|
||||
if (-not (Test-Path -LiteralPath $Path)) {
|
||||
throw "Salon Core 发布包不存在:$Path"
|
||||
}
|
||||
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
$zip = [System.IO.Compression.ZipFile]::OpenRead($Path)
|
||||
try {
|
||||
$migrationEntries = @($zip.Entries | Where-Object { $_.FullName -match '^BOOT-INF/classes/db/migration/V[0-9]+__[^/]+\.sql$' })
|
||||
$baselineEntry = $zip.GetEntry("BOOT-INF/classes/db/migration/V1__Salon空库初始化.sql")
|
||||
$flywayLibrary = @($zip.Entries | Where-Object { $_.FullName -match '^BOOT-INF/lib/flyway-core-[^/]+\.jar$' })
|
||||
$mysqlLibrary = @($zip.Entries | Where-Object { $_.FullName -match '^BOOT-INF/lib/flyway-mysql-[^/]+\.jar$' })
|
||||
if (-not $baselineEntry -or $migrationEntries.Count -eq 0 -or $flywayLibrary.Count -eq 0 -or $mysqlLibrary.Count -eq 0) {
|
||||
throw "Salon Core JAR 未包含 Flyway Core、MySQL 适配器和 V1 数据库基线:$Path"
|
||||
}
|
||||
}
|
||||
finally {
|
||||
$zip.Dispose()
|
||||
}
|
||||
}
|
||||
|
||||
function Get-ColumnIndex {
|
||||
param([string]$CellRef)
|
||||
|
||||
@@ -594,6 +617,7 @@ function Build-ReleasePackage {
|
||||
throw "缺少发布产物:$requiredPath"
|
||||
}
|
||||
}
|
||||
Assert-FlywayMigrationPackaged $coreJar
|
||||
|
||||
$coreArtifact = Join-Path $backendDir "JC-Salon-Core.jar"
|
||||
$gatewayArtifact = Join-Path $backendDir "JC-Salon-Gateway.jar"
|
||||
@@ -919,6 +943,7 @@ function Get-ExistingReleasePackage {
|
||||
throw "发布包缺少文件:$requiredPath"
|
||||
}
|
||||
}
|
||||
Assert-FlywayMigrationPackaged $coreArtifact
|
||||
$hashes = foreach ($artifact in @($coreArtifact, $gatewayArtifact, $frontendArtifact, $sqlArtifact)) {
|
||||
$hash = Get-FileHash -LiteralPath $artifact -Algorithm SHA256
|
||||
[pscustomobject]@{ Path = $artifact.Replace($releaseDir, "").TrimStart("\", "/"); Sha256 = $hash.Hash }
|
||||
|
||||
Reference in New Issue
Block a user