Initial commit: 浼佷笟寰俊 AI 鏈哄櫒浜哄姪鐞?MVP

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
bujie9527
2026-02-05 16:36:32 +08:00
commit 59275ed4dc
126 changed files with 9120 additions and 0 deletions

27
deploy/scripts/migrate.sh Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# 一键迁移Docker在项目根目录执行
# 用法: bash deploy/scripts/migrate.sh 或 ./deploy/scripts/migrate.sh
set -e
cd "$(dirname "$0")/../.."
echo "[1/3] 启动数据库..."
docker compose up -d db
echo "[2/3] 等待数据库就绪..."
max=30
for i in $(seq 1 $max); do
if docker compose exec -T db pg_isready -U wecom -d wecom_ai 2>/dev/null; then
break
fi
if [ "$i" -eq "$max" ]; then
echo "数据库未在 ${max}s 内就绪,请检查 docker compose logs db"
exit 1
fi
sleep 1
done
echo "[3/3] 执行 Alembic 迁移..."
docker compose run --rm backend sh -c "alembic upgrade head"
echo "迁移完成。"