feat: add guarded application schema initialization
This commit is contained in:
1 parent
3cd0bebf4d
commit
6190e58511
2 files changed
+170
No files matched your search
@@ -0,0 +1,18 @@
|
||||
# AI SoulMate 本地数据库初始化
|
||||
|
||||
基础设施 Compose 只创建空的 `ai_soulmate` 数据库,不自动导入业务表。这样可以先验证 PostgreSQL 数据卷和备份恢复,再由已确认的源码分支初始化业务结构。
|
||||
|
||||
初始化脚本只接受 `ai-soulmate-server` 的 `local-deployment` 分支。它会检查基础 SQL 的所有者和 `search_path`,在单个事务中创建基础表,先应用本地结构对齐脚本 `005`,然后按顺序应用 `006` 至 `013` 增量脚本并记录 SHA-256。针对旧线上事故数据的 `014_repair_half_merged_accounts_20260803.sql` 明确不会执行。
|
||||
|
||||
```bash
|
||||
cd /srv/ai-soulmate-local-deployment
|
||||
git pull --ff-only
|
||||
|
||||
git -C /srv/ai-soulmate/sources/ai-soulmate-server pull --ff-only
|
||||
|
||||
./scripts/initialize-app-database.sh \
|
||||
compose/.env \
|
||||
/srv/ai-soulmate/sources/ai-soulmate-server
|
||||
```
|
||||
|
||||
成功结果必须包含源提交、`Public tables` 和 `Recorded schema files`。脚本可重复执行;已经登记且校验和一致的文件会跳过。若数据库存在业务表但没有本地迁移登记,脚本会停止,不会尝试接管未知数据库。
|
||||
Reference in new issue
Block a user