param(
    [string]$RootUser = "root"
)

$ErrorActionPreference = "Stop"
$ProjectRoot = Split-Path -Parent $PSScriptRoot
Push-Location (Join-Path $ProjectRoot "backend")
try {
    uv run python -m zbt.commands.init_databases --root-user $RootUser
    if ($LASTEXITCODE -ne 0) {
        throw "数据库初始化失败。"
    }
}
finally {
    Pop-Location
}
