feat: migrate backend storage to postgres
Some checks failed
Deploy to Production / Build and Test (push) Successful in 10m51s
Deploy to Production / Deploy to Server (push) Failing after 6m41s

This commit is contained in:
你的用户名
2025-11-06 22:01:50 +08:00
parent 3646405a47
commit b68511b2e2
28 changed files with 2641 additions and 1801 deletions

View File

@@ -69,6 +69,33 @@ sudo docker-compose down || true
echo "🚀 构建并启动新容器..."
sudo docker-compose up -d --build
# 等待PostgreSQL就绪
echo "⏳ 等待PostgreSQL就绪..."
POSTGRES_READY=0
for i in {1..10}; do
if sudo docker-compose exec -T postgres pg_isready -U kt_financial -d kt_financial > /dev/null 2>&1; then
echo "✅ PostgreSQL 已就绪"
POSTGRES_READY=1
break
fi
echo " 第${i}次重试..."
sleep 3
done
if [ "$POSTGRES_READY" -ne 1 ]; then
echo "❌ PostgreSQL 未在预期时间内就绪"
exit 1
fi
# 导入数据
echo "📦 导入财务数据..."
sudo docker-compose exec -T kt-financial \
bash -lc "pnpm --filter @vben/backend import:data -- --csv /app/data/finance/finance-combined.csv --year 2025"
# 验证数据条数
echo "🔢 检查交易记录条数..."
sudo docker-compose exec -T postgres \
psql -U kt_financial -d kt_financial -c "SELECT COUNT(*) AS transaction_count FROM finance_transactions;"
# 清理旧镜像
echo "🧹 清理旧镜像..."
sudo docker image prune -f