Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

30 řádky
1.5KB

  1. @echo off
  2. rem Restores the SQLite database from a backup made by scripts\backup.cmd. Run from the repo root.
  3. rem
  4. rem scripts\restore.cmd db/backups/app-YYYYMMDD-HHMMSS.sqlite
  5. rem
  6. rem 1. stops the HTTP server and the embed worker (nothing may write during the copy)
  7. rem 2. verifies the backup (integrity_check, foreign keys, migrations); if it fails nothing is changed
  8. rem 3. keeps the current database as db\backups\pre-restore-<timestamp>.sqlite and copies the backup over it
  9. rem 4. starts the server and the worker again, then rebuilds the vector index from the restored data
  10. rem (Qdrant is derived data and may hold vectors for rows the backup does not have)
  11. rem If the restored schema is older than the code, run scripts\migrate.cmd up afterwards.
  12. setlocal
  13. if "%~1"=="" (
  14. echo Usage: scripts\restore.cmd db/backups/^<file^>.sqlite
  15. exit /b 1
  16. )
  17. docker compose stop axonasp embed-worker || exit /b 1
  18. docker compose run --rm --no-deps -T -e SERVER_WEB_ROOT=/opt/axonasp/site -e BACKUP_ACTION=restore -e "BACKUP_FILE=%~1" axonasp ./axonasp-cli -r /opt/axonasp/site/scripts/backup.asp > "%TEMP%\amk-restore.log"
  19. set RC=%errorlevel%
  20. type "%TEMP%\amk-restore.log"
  21. docker compose start axonasp embed-worker
  22. findstr /b /c:"RESULT: ok" "%TEMP%\amk-restore.log" >nul
  23. if errorlevel 1 (
  24. echo Restore FAILED, see the messages above. If the backup did not verify, nothing was changed; if the copy
  25. echo had started, the previous database is in db\backups\pre-restore-^<timestamp^>.sqlite.
  26. exit /b 1
  27. )
  28. call "%~dp0embed.cmd" reindex
  29. exit /b 0

Powered by TurnKey Linux.