diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/db | 26 | ||||
-rwxr-xr-x | bin/watch | 15 |
2 files changed, 41 insertions, 0 deletions
@@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -euo pipefail +cd $(dirname "$0")/.. + +DB_PATH="database.db" + +if [ "$1" == "init" ]; then + + if [ -f "$DB_PATH" ]; then + rm "$DB_PATH" + fi + + for MIGRATION in $(ls sql/migrations); do + printf "\n- Applying sql/migrations/$MIGRATION\n\n" + sqlite3 database.db < "sql/migrations/$MIGRATION" + done + + printf "\n- Applying sql/fixtures.sql\n\n" + sqlite3 database.db < sql/fixtures.sql + +else + + echo "Usage: $0 init" + exit 1 + +fi diff --git a/bin/watch b/bin/watch new file mode 100755 index 0000000..84363fb --- /dev/null +++ b/bin/watch @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail +cd $(dirname "$0")/.. + +CMD=${1:-check} + +RUST_LOG=budget=info cargo-watch \ + --ignore README.md \ + --ignore bin \ + --ignore sql \ + --ignore database.db \ + --ignore database.db-shm \ + --ignore database.db-wal \ + --clear \ + -x "$CMD" |