migrate.ps1 595 B

1234567891011121314
  1. $ErrorActionPreference = "Stop"
  2. $ProjectRoot = Split-Path -Parent $PSScriptRoot
  3. Push-Location (Join-Path $ProjectRoot "backend")
  4. try {
  5. uv run alembic -c alembic.ini --name alembic_core upgrade head
  6. if ($LASTEXITCODE -ne 0) { throw "Core 数据库迁移失败。" }
  7. uv run alembic -c alembic.ini --name alembic_agent upgrade head
  8. if ($LASTEXITCODE -ne 0) { throw "Agent 数据库迁移失败。" }
  9. uv run alembic -c alembic.ini --name alembic_analytics upgrade head
  10. if ($LASTEXITCODE -ne 0) { throw "Analytics 数据库迁移失败。" }
  11. }
  12. finally {
  13. Pop-Location
  14. }