summaryrefslogtreecommitdiff
path: root/modes/reset.sh
blob: 4a8a3fcc2154989d0ddbbabadf36902e1ff9b681 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
# reset — destroy and rebuild the environment from scratch (DESTRUCTIVE)
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=base.sh
source "$SCRIPT_DIR/base.sh"

cd "$PROJECT_ROOT"

echo "WARNING: This will destroy and rebuild the environment."
echo "All local state will be lost."
echo ""
read -rp "Continue? [y/N] " confirm
[[ "$confirm" =~ ^[Yy]$ ]] || { echo "Aborted."; exit 1; }

# ── TODO: implement your teardown and rebuild steps ───────────────────────────

# Example: Docker Compose teardown + rebuild
# docker compose down --volumes --remove-orphans
# docker compose build --no-cache
# docker compose up -d
# docker compose exec app <your-migration-command>

# Example: nix / devenv
# nix flake update
# direnv reload

echo "error: no reset steps configured in modes/reset.sh" >&2
exit 1