fix: 启动时自动迁移缺失的数据库列
问题:旧版数据库缺少 user_id 列导致 500 错误 修复: - init.ts 启动时自动检测并添加缺失列 - 删除 deploy/ 目录,改为手动部署 - 添加 migrate.sql 迁移脚本 - 更新 CLAUDE.md 部署说明
This commit is contained in:
21
CLAUDE.md
21
CLAUDE.md
@@ -145,6 +145,27 @@ cd server && npm run db:init
|
||||
- MySQL: 本地 3306 端口
|
||||
- 微信小程序上线需配置 HTTPS 域名 (替换 `request.ts` 中的 `BASE_URL`)
|
||||
|
||||
### 手动部署步骤
|
||||
|
||||
```bash
|
||||
# 1. 本地构建后端
|
||||
cd server && npm run build
|
||||
|
||||
# 2. 复制 dist 目录到服务器
|
||||
scp -r server/dist/* root@106.14.208.43:/var/www/xiaocai/
|
||||
|
||||
# 3. SSH 到服务器
|
||||
ssh root@106.14.208.43
|
||||
|
||||
# 4. 安装依赖(如 node_modules 已存在可跳过)
|
||||
cd /var/www/xiaocai && npm install --production
|
||||
|
||||
# 5. 重启服务
|
||||
pm2 restart xiaocai-server
|
||||
# 或直接运行
|
||||
node dist/index.js
|
||||
```
|
||||
|
||||
## 开发
|
||||
|
||||
@DEV.md
|
||||
|
||||
Reference in New Issue
Block a user