Files
FT546MWS/scripts/shadow-v3-install.cmd
zgw 699310e61d fix(shadow): align outbound predicates with site data for v3.3
Use the business project and captured site predicates, validate single-stock proposals, and skip unsupported scopes without changing Legacy. Add the guarded V3.3 SQL upgrade, CMD operations, regression tests and deployment runbook.
2026-09-07 12:43:43 +08:00

43 lines
1.5 KiB
Batchfile

@echo off
setlocal EnableExtensions DisableDelayedExpansion
if "%~1"=="" goto :usage
if "%~2"=="" goto :usage
if "%~3"=="" goto :usage
set "SQL_SERVER=%~1"
set "DATABASE=%~2"
set "MODE=%~3"
set "SQL_FILE="
set "V33_FILE=%~dp0..\fortucky-algorithm\src\main\resources\db\sqlserver\upgrade-shadow-v3-to-v33.sql"
if /I "%~3"=="upgrade" set "SQL_FILE=%~dp0..\fortucky-algorithm\src\main\resources\db\sqlserver\upgrade-shadow-v2-to-v3.sql"
if /I "%~3"=="clean" set "SQL_FILE=%~dp0..\fortucky-algorithm\src\main\resources\db\sqlserver\install-shadow.sql"
if /I "%~3"=="v33" set "SQL_FILE=%V33_FILE%"
if not defined SQL_FILE (call :fail "mode must be upgrade, clean or v33" & exit /b 1)
if not exist "%SQL_FILE%" (call :fail "SQL package file is missing" & exit /b 1)
if not exist "%V33_FILE%" (call :fail "V3.3 SQL package file is missing" & exit /b 1)
where sqlcmd >nul 2>nul
if errorlevel 1 (call :fail "sqlcmd is not available on PATH" & exit /b 1)
echo WARNING: stop the WMS shadow-enabled JVM and wait over 120 seconds first.
echo Installing FT546WMS shadow V3.3 in %MODE% mode...
sqlcmd -S "%SQL_SERVER%" -d "%DATABASE%" -E -b -r1 -i "%SQL_FILE%"
if errorlevel 1 exit /b 1
if /I "%MODE%"=="v33" goto :installed
sqlcmd -S "%SQL_SERVER%" -d "%DATABASE%" -E -b -r1 -i "%V33_FILE%"
if errorlevel 1 exit /b 1
:installed
echo INSTALL_OK mode=%MODE%
exit /b 0
:usage
echo Usage: %~nx0 SQL_SERVER DATABASE upgrade^|clean^|v33 1>&2
exit /b 2
:fail
echo INSTALL_FAILED %~1 1>&2
exit /b 1