新增订单群聊
This commit is contained in:
+16
-2
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user