From c7871c94b5a0eb7aeb7d063790d4085c42daabcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9A=E9=80=9A?= Date: Sun, 29 Mar 2026 11:40:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E8=BF=9C=E7=A8=8B=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=90=8E=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 01b30299..4662d561 100644 --- a/deploy.sh +++ b/deploy.sh @@ -48,7 +48,11 @@ echo "🔄 重启 Docker 服务..." $DC_CMD down --remove-orphans || echo "⚠️ Warning: docker-compose down returned error, attempting to continue..." $DC_CMD up -d --build -# 5. 清理未使用镜像 +# 5. 执行数据库迁移(SQLAlchemy / Alembic) +echo "🗄️ 执行数据库表结构更新..." +$DC_CMD exec -T hxops-backend flask --app manage.py db upgrade || { echo "❌ 数据库迁移失败"; exit 1; } + +# 6. 清理未使用镜像 echo "🧹 清理旧镜像..." docker image prune -f