14 lines
596 B
Bash
Executable file
14 lines
596 B
Bash
Executable file
#!/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 <name>)." >&2
|
|
exit 2 # Exit 2 blockiert den Tool-Aufruf; die Meldung geht an Claude zurück
|
|
fi
|
|
exit 0
|