schon/scripts/Windows/migrate-media.ps1
Egor fureunoir Gorbunov adec5503b2 feat(core/auth): enable encryption for sensitive fields and token handling
Add encryption for user PII fields (phone number, name, attributes) and address fields to enhance data security. Introduced timestamped activation tokens for improved validation. Included migrations to encrypt existing plaintext data.

Refactored GraphQL settings to limit query depth and optionally disable introspection for enhanced API defense. Implemented throttling to safeguard API rates.

Improved Dockerfiles for better user management and restored media migration tools for smooth instance upgrades.
2026-03-02 00:11:57 +03:00

51 lines
1.9 KiB
PowerShell

# =============================================================================
# migrate-media.ps1
# Migrates user-uploaded media files from host bind-mount (eVibes / early Schon)
# into the new Docker-managed named volume (media-data).
#
# Run this ONCE after upgrading from an eVibes or pre-volume Schon instance.
# =============================================================================
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$HostMedia = Join-Path (Get-Location) "media"
Write-Host "Schon - media migration from host bind-mount to named volume" -ForegroundColor Cyan
Write-Host ""
if (-not (Test-Path $HostMedia)) {
Write-Host "No .\media directory found on host. Nothing to migrate." -ForegroundColor Yellow
exit 0
}
$FileCount = (Get-ChildItem -Path $HostMedia -Recurse -File).Count
if ($FileCount -eq 0) {
Write-Host "Host .\media directory is empty. Nothing to migrate." -ForegroundColor Yellow
exit 0
}
Write-Host "Found $FileCount file(s) in $HostMedia" -ForegroundColor White
Write-Host ""
Write-Host "This will copy them into the Docker named volume 'media-data'." -ForegroundColor White
$confirm = Read-Host "Continue? [y/N]"
if ($confirm -ne "y" -and $confirm -ne "Y") {
Write-Host "Migration cancelled." -ForegroundColor Yellow
exit 0
}
Write-Host ""
Write-Host "Copying files..." -ForegroundColor White
$HostMediaUnix = $HostMedia -replace '\\', '/' -replace '^([A-Za-z]):', { "/$(($_.Value[0]).ToString().ToLower())" }
docker compose run --rm `
-v "${HostMediaUnix}:/old_media:ro" `
app bash -c @"
cp -a /old_media/. /app/media/
COUNT=`$(find /app/media -type f | wc -l)
echo "Migration complete: `$COUNT file(s) now in media volume."
"@
Write-Host ""
Write-Host "Done. You can safely ignore the host .\media directory - it is no longer used." -ForegroundColor Green
Write-Host "To remove it: Remove-Item -Recurse -Force .\media" -ForegroundColor Gray