Files
2026-05-22 15:57:49 -06:00

25 lines
475 B
Bash
Executable File

#!/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