Files
Lannamokia 803e6cdaee feat: 添加PostgreSQL数据库集成和机台管理功能
- 新增PostgreSQL数据库支持,包含内置和外部数据库两种部署模式
- 实现机台管理功能,包括保护状态控制和VHD关键词设置
- 添加用户认证系统,支持会话管理和权限控制
- 更新Docker配置,支持数据库持久化和健康检查
- 扩展API接口,提供完整的RESTful API文档
- 更新客户端代码以支持机台ID和保护检查功能
- 添加数据库初始化脚本和配置指南
2025-10-21 20:10:18 +08:00

68 lines
1.7 KiB
Batchfile

@echo off
chcp 65001 >nul
echo.
echo ========================================
echo PostgreSQL Database Setup Script
echo ========================================
echo.
REM Check if PostgreSQL is installed
echo Checking PostgreSQL installation...
psql --version >nul 2>&1
if %errorlevel% neq 0 (
echo ERROR: PostgreSQL is not installed or not in PATH
echo.
echo Please install PostgreSQL first:
echo 1. Download from: https://www.postgresql.org/download/windows/
echo 2. Run the installer as administrator
echo 3. Set superuser password to: password
echo 4. Use default port: 5432
echo 5. Add PostgreSQL bin directory to PATH
echo.
echo After installation, run this script again.
pause
exit /b 1
)
echo SUCCESS: PostgreSQL is installed
echo.
REM Prompt for PostgreSQL superuser password
echo Please enter PostgreSQL superuser password:
set /p "PGPASSWORD=Password: "
echo.
REM Set environment variable for password
set PGPASSWORD=%PGPASSWORD%
echo Setting up database...
echo.
REM Execute the SQL setup script
psql -U postgres -h localhost -f setup_postgresql.sql
if %errorlevel% equ 0 (
echo.
echo SUCCESS: Database setup completed successfully!
echo.
echo Database Information:
echo Host: localhost
echo Port: 5432
echo Database: vhd_select
echo User: postgres
echo.
echo You can now start the VHDSelectServer:
echo node server.js
echo.
) else (
echo.
echo ERROR: Database setup failed!
echo Please check the error messages above and try again.
echo.
)
REM Clear password from environment
set PGPASSWORD=
echo Press any key to exit...
pause >nul