mirror of
https://github.com/bitwarden/server.git
synced 2026-01-31 06:03:12 +08:00
Fix pattern matching when retrieving database migrations (#6815)
This commit is contained in:
@@ -41,7 +41,7 @@ $migrationPath = "util/Migrator/DbScripts"
|
|||||||
|
|
||||||
# Get list of migrations from base reference
|
# Get list of migrations from base reference
|
||||||
try {
|
try {
|
||||||
$baseMigrations = git ls-tree -r --name-only $BaseRef -- "$migrationPath/*.sql" 2>$null | Sort-Object
|
$baseMigrations = git ls-tree -r --name-only $BaseRef -- "$migrationPath/" 2>$null | Where-Object { $_ -like "*.sql" } | Sort-Object
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
Write-Host "Warning: Could not retrieve migrations from base reference '$BaseRef'"
|
Write-Host "Warning: Could not retrieve migrations from base reference '$BaseRef'"
|
||||||
$baseMigrations = @()
|
$baseMigrations = @()
|
||||||
@@ -53,7 +53,7 @@ catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Get list of migrations from current reference
|
# Get list of migrations from current reference
|
||||||
$currentMigrations = git ls-tree -r --name-only $CurrentRef -- "$migrationPath/*.sql" | Sort-Object
|
$currentMigrations = git ls-tree -r --name-only $CurrentRef -- "$migrationPath/" | Where-Object { $_ -like "*.sql" } | Sort-Object
|
||||||
|
|
||||||
# Find added migrations
|
# Find added migrations
|
||||||
$addedMigrations = $currentMigrations | Where-Object { $_ -notin $baseMigrations }
|
$addedMigrations = $currentMigrations | Where-Object { $_ -notin $baseMigrations }
|
||||||
|
|||||||
Reference in New Issue
Block a user