Files
AIRegulation-Deployment/scripts/reset_all.sh
2026-04-23 09:58:47 +08:00

38 lines
1.6 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# ══════════════════════════════════════════════════
# reset_all.sh
# ⚠️ 危险操作:停止所有服务并删除所有数据(慎用!)
# 用法bash scripts/reset_all.sh
# ══════════════════════════════════════════════════
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_DIR"
RED='\033[0;31m'; YELLOW='\033[1;33m'; NC='\033[0m'
echo ""
echo -e "${RED}╔══════════════════════════════════════════╗${NC}"
echo -e "${RED}║ ⚠️ 警告:此操作将删除所有数据! ║${NC}"
echo -e "${RED}║ 包括PostgreSQL / Milvus / Neo4j 数据 ║${NC}"
echo -e "${RED}║ 以及所有上传的文件和日志 ║${NC}"
echo -e "${RED}╚══════════════════════════════════════════╝${NC}"
echo ""
echo -e "${YELLOW}确认要重置所有数据吗?(输入 'yes' 确认,其他取消)${NC}"
read -r CONFIRM
if [[ "$CONFIRM" != "yes" ]]; then
echo "已取消"
exit 0
fi
echo ""
echo "停止所有服务..."
docker compose down --volumes --remove-orphans
echo "清理数据目录..."
rm -rf data/uploads/* data/parsed/* logs/*
echo "✓ 数据目录已清空(保留目录结构)"
echo ""
echo -e "${YELLOW}重置完成。重新启动bash scripts/06_start_all.sh${NC}"