# Local SQLite+media backup/restore for the holiday test phase. # The archive can contain personal unencrypted journal data. No .env or keys. [CmdletBinding()] param( [Parameter(Position = 0)] [ValidateSet("create", "restore")] [string]$Action = "create", [string]$Out, [string]$Archive, [switch]$Confirm, [switch]$Replace ) $ErrorActionPreference = "Stop" Set-StrictMode -Version Latest $root = Split-Path -Parent $PSScriptRoot $py = Join-Path $root "backend\.venv\Scripts\python.exe" if (-not (Test-Path $py)) { $py = "python" } $env:PYTHONUTF8 = "1" $env:PYTHONIOENCODING = "utf-8" $argsList = @((Join-Path $root "backend\local_backup.py"), $Action) if ($Action -eq "create" -and $Out) { $argsList += @("--out", $Out) } if ($Action -eq "restore") { if (-not $Archive) { throw "Restore braucht -Archive " } $argsList += @($Archive) if ($Confirm) { $argsList += "--confirm" } if ($Replace) { $argsList += "--replace" } } & $py @argsList exit $LASTEXITCODE