reset-dev-data.sh 899 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  4. project_root="$(cd "$script_dir/.." && pwd)"
  5. expected="RESET insurance_s1"
  6. confirmation="${1:-}"
  7. echo "即将重建数据库:insurance_s1_core、insurance_s1_agent、insurance_s1_analytics"
  8. echo "即将删除 Redis 前缀:ins:s1:*"
  9. if [[ -z "${confirmation//[[:space:]]/}" ]]; then
  10. read -r -p "请输入 $expected 继续: " confirmation
  11. fi
  12. [[ "$confirmation" == "$expected" ]] || { echo "确认文本不匹配,已取消。" >&2; exit 1; }
  13. cd "$project_root/backend"
  14. uv run alembic -c alembic.ini --name alembic_analytics downgrade base
  15. uv run alembic -c alembic.ini --name alembic_agent downgrade base
  16. uv run alembic -c alembic.ini --name alembic_core downgrade base
  17. uv run python -m zbt.commands.reset_cache
  18. "$script_dir/migrate.sh"
  19. "$script_dir/seed.sh"
  20. "$script_dir/build-analytics.sh"