新增订单群聊

This commit is contained in:
yml
2026-05-25 14:57:19 +08:00
parent 1a3886f8d1
commit 7e7e6dc166
18 changed files with 2152 additions and 225 deletions
+16 -2
View File
@@ -71,9 +71,23 @@ init_database() {
if [[ "${table_count}" == "0" ]]; then
log "首次启动,初始化数据库结构..."
docker exec -i hfb-mysql mysql -uhfb -psecret hfb_sys < "${ROOT_DIR}/backend/migrations/000001_init.sql"
local migration
for migration in "${ROOT_DIR}"/backend/migrations/*.sql; do
log "执行迁移:$(basename "${migration}")"
docker exec -i hfb-mysql mysql -uhfb -psecret hfb_sys < "${migration}"
done
else
log "数据库结构已存在,跳过迁移"
local chat_table_count
chat_table_count="$(
docker exec hfb-mysql mysql -uhfb -psecret -N -s -e \
"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'hfb_sys' AND table_name = 'chat_conversations';" 2>/dev/null
)"
if [[ "${chat_table_count}" == "0" ]]; then
log "补充聊天表迁移:000002_chat.sql"
docker exec -i hfb-mysql mysql -uhfb -psecret hfb_sys < "${ROOT_DIR}/backend/migrations/000002_chat.sql"
else
log "数据库结构已存在,跳过迁移"
fi
fi
}