blob: 186f83d4941c5b84556a5b9bb099ae2268b62c9e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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/*.sql); do
printf "\n- Applying $MIGRATION\n\n"
sqlite3 database.db < "$MIGRATION"
done
printf "\n- Applying sql/fixtures.sql\n\n"
sqlite3 database.db < sql/fixtures.sql
else
echo "Usage: $0 init"
exit 1
fi
|