Add Linux and macOS execution commands
Some checks failed
Repo Quality / structure (push) Has been cancelled
Some checks failed
Repo Quality / structure (push) Has been cancelled
This commit is contained in:
28
scripts/reset-scenario.sh
Normal file
28
scripts/reset-scenario.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 <scenario> <connect_string> [sql_client]" >&2
|
||||
}
|
||||
|
||||
if [[ $# -lt 2 ]]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SCENARIO="$1"
|
||||
CONNECT_STRING="$2"
|
||||
SQL_CLIENT="${3:-sql}"
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
RESET_SCRIPT="$REPO_ROOT/scenarios/$SCENARIO/sql/99_reset.sql"
|
||||
|
||||
if [[ ! -f "$RESET_SCRIPT" ]]; then
|
||||
echo "Reset script not found: $RESET_SCRIPT" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Resetting scenario $SCENARIO"
|
||||
"$SQL_CLIENT" "$CONNECT_STRING" "@$RESET_SCRIPT"
|
||||
|
||||
Reference in New Issue
Block a user