#!/usr/bin/env bash
set -euo pipefail

# 危險：停止 stack 並刪除 Mongo/Redis named volume。

# shellcheck source=scripts/prod-common.sh
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/prod-common.sh"

prod_load_env
prod_require_docker

cd "$DEPLOY_DIR"

echo "[prod] 這會刪除 haixun-prod_mongo_data 與 haixun-prod_redis_data 內所有資料。"
read -r -p "輸入 yes 才會繼續: " confirm
if [[ "$confirm" != "yes" ]]; then
  echo "[prod] cancelled"
  exit 1
fi

prod_compose down -v --remove-orphans
echo "[prod] volumes removed — 下次 make prod 會是全新資料庫"