feat: 引入版本化数据库迁移与 Schema 启动门禁

This commit is contained in:
weijuesen
2026-08-13 22:51:45 +08:00
parent 20bea001ac
commit 8b977e4164
15 changed files with 779 additions and 45 deletions
+6
View File
@@ -434,6 +434,8 @@ chmod +x /home/pan/silk-server-go-linux
# 创建 .env
cat > /home/pan/silk/.env << 'EOF'
PORT=3000
APP_ENV=production
ALLOW_DEV_AUTOMIGRATE=false
PG=postgresql://postgres:pan@localhost:5432/silk
REDIS=redis://:pan@localhost:6379
MQTT=mqtt://pan:pan@localhost:1883
@@ -457,6 +459,8 @@ cd /home/pan/silk
nohup /home/pan/silk-server-go-linux > server-go.log 2>&1 < /dev/null &
```
> **数据库迁移**:Go 后端启动时会自动执行 `server-go/migrations/` 下的 SQL 迁移并校验 `schema_migrations` 版本;生产环境不要开启 `ALLOW_DEV_AUTOMIGRATE=true`。升级前先按 AGENTS.md 完成数据库备份。
### 11. 部署 Go 录制服务
```bash
@@ -565,6 +569,8 @@ sudo ceph -s
```
PORT=3000
PG=postgresql://postgres:pan@localhost:5432/silk
APP_ENV=production
ALLOW_DEV_AUTOMIGRATE=false
REDIS=redis://:pan@localhost:6379
MQTT=mqtt://pan:pan@localhost:1883
IOTDB_URL=http://127.0.0.1:18081