Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

1.4 KB
Raw Blame
param(
  [string]$RustLog = "info",
  [string]$DbxPassword = "test",
  [switch]$NoWatch,
  [switch]$DryRun
)

$ErrorActionPreference = "Stop"

$repoRoot = Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "..")
Set-Location -LiteralPath $repoRoot

$env:RUST_LOG = $RustLog
$env:DBX_PASSWORD = $DbxPassword

Write-Host "[dbx-backend] repo: $repoRoot" -ForegroundColor Cyan
Write-Host "[dbx-backend] RUST_LOG=$env:RUST_LOG DBX_PASSWORD=$env:DBX_PASSWORD" -ForegroundColor DarkCyan

if ($DryRun) {
  if ($NoWatch) {
    Write-Host "[dbx-backend] dry run: cargo run -p dbx-web" -ForegroundColor Yellow
  } else {
    Write-Host "[dbx-backend] dry run: cargo watch -x 'run -p dbx-web' (fallback: cargo run -p dbx-web)" -ForegroundColor Yellow
  }
  exit 0
}

$watchAvailable = $false
if (-not $NoWatch) {
  try {
    & cargo watch --version *> $null
    $watchAvailable = ($LASTEXITCODE -eq 0)
  } catch {
    $watchAvailable = $false
  }
}

if ($watchAvailable) {
  Write-Host "[dbx-backend] starting: cargo watch -x 'run -p dbx-web'" -ForegroundColor Green
  & cargo watch -x "run -p dbx-web"
  exit $LASTEXITCODE
}

if (-not $NoWatch) {
  Write-Warning "cargo-watch is unavailable; falling back to cargo run -p dbx-web. Install with: cargo install cargo-watch"
}

Write-Host "[dbx-backend] starting: cargo run -p dbx-web" -ForegroundColor Green
& cargo run -p dbx-web
exit $LASTEXITCODE