#!/usr/bin/env bash # Verhindert, dass bereits committete Supabase-Migrationen verändert werden. # Neue (noch nicht in git bekannte) Migrationen sind erlaubt. set -euo pipefail file=$(jq -r '.tool_input.file_path // empty') [[ "$file" == */supabase/migrations/*.sql ]] || exit 0 cd "${CLAUDE_PROJECT_DIR:-.}" if git ls-files --error-unmatch "$file" >/dev/null 2>&1; then echo "Bestehende Migration $file darf nicht geändert werden. Lege eine neue Migration an (supabase migration new )." >&2 exit 2 # Exit 2 blockiert den Tool-Aufruf; die Meldung geht an Claude zurück fi exit 0