File size: 1,325 Bytes
6ea020b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
@echo off
setlocal
set "VENV_PATH=venv"
set "PYTHON_EXE=%VENV_PATH%\Scripts\python.exe"

echo ==========================================
echo       NexLab System Update Tool
echo ==========================================
echo.

:: Step 1: Backup Database
echo [Step 1/3] Backing up database...
"%PYTHON_EXE%" tools\backup_db.py
if %ERRORLEVEL% NEQ 0 (
    echo ERROR: Database backup failed. Update cancelled for safety.
    pause
    exit /b %ERRORLEVEL%
)
echo.

:: Step 2: Inform User about Code Updates
echo [Step 2/3] Code Updates
echo Please ensure you have copied the new system files into this folder.
echo (If you are using Git, you would 'git pull' now.)
echo.
set /p confirm="Have you updated the system files? (y/n): "
if /i "%confirm%" NEQ "y" (
    echo Update paused. Please copy the new files and run this script again.
    pause
    exit /b 0
)
echo.

:: Step 3: Run Migrations
echo [Step 3/3] Running database migrations...
"%PYTHON_EXE%" migrations\run_all.py
if %ERRORLEVEL% NEQ 0 (
    echo ERROR: Migrations failed. Please check the logs.
    pause
    exit /b %ERRORLEVEL%
)
echo.

echo ==========================================
echo System Update Completed Successfully!
echo ==========================================
echo.
echo You can now restart the system using 'start_nexlab.bat'.
echo.
pause