-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_db_now.bat
More file actions
24 lines (18 loc) · 908 Bytes
/
init_db_now.bat
File metadata and controls
24 lines (18 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@echo off
chcp 65001 >nul
echo [WMS] 开始初始化数据库...
set PGPASSWORD=123456
echo.
echo [步骤1] 删除旧数据库...
"D:\Program Files\PostgreSQL\17\bin\psql.exe" -U postgres -c "DROP DATABASE IF EXISTS wms_db;" 2>nul
echo [步骤2] 创建新数据库...
"D:\Program Files\PostgreSQL\17\bin\psql.exe" -U postgres -c "CREATE DATABASE wms_db ENCODING = 'UTF8';"
echo [步骤3] 导入表结构和数据...
"D:\Program Files\PostgreSQL\17\bin\psql.exe" -U postgres -d wms_db -f "D:\WMS\database\quick_init.sql"
echo.
echo [步骤4] 验证数据...
"D:\Program Files\PostgreSQL\17\bin\psql.exe" -U postgres -d wms_db -c "SELECT 'Tables: ' || COUNT(*) FROM information_schema.tables WHERE table_schema IN ('wms', 'sys');"
"D:\Program Files\PostgreSQL\17\bin\psql.exe" -U postgres -d wms_db -c "SELECT 'Users: ' || COUNT(*) FROM sys.sys_user;"
echo.
echo [完成] 数据库初始化完成!
echo.