#!/usr/bin/env bash DB_NAME="database.sqlite" if [ -z "$1" ]; then echo "You need to tell me up or down" exit 1 fi if [[ "$1" == "up" ]]; then rm -f "$DB_NAME" touch "$DB_NAME" for file in migrations/*.up.sql; do echo "Executing $file..." sqlite3 "$DB_NAME" < "$file" done fi if [[ "$1" == "down" ]]; then for file in migrations/*.down.sql; do echo "Executing $file..." sqlite3 "$DB_NAME" < "$file" done fi