-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·25 lines (24 loc) · 1.05 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
if [[ $1 == "" ]]; then
echo "give me database name"
exit
fi
java -jar ./gienerator2/out/artifacts/gienerator2_jar/gienerator2.jar
echo "concatening..."
cat heartrates.sql sleeps.sql supplies.sql sessions.sql user_session.sql h_w.sql sections.sql sessions_sect.sql user_session_sect.sql > generated_data.sql
rm heartrates.sql sleeps.sql supplies.sql sessions.sql user_session.sql range.txt h_w.sql sections.sql user_session_sect.sql sessions_sect.sql
psql "$1" < ./sql/clear.sql
# echo "rebuilding database..."
# psql "$1" < ./sql/tables.sql #--quiet > /dev/null 2>&1
# echo "injecting functions..."
# psql "$1" < ./sql/functions.sql #--quiet > /dev/null 2>&1
# psql "$1" < ./sql/views_rules.sql #--quiet > /dev/null 2>&1
echo "rebuilding database..."
psql "$1" < ./sql/create.sql
echo "injecting data..."
psql "$1" < ./sql/data.sql #--quiet > /dev/null 2>&1
psql "$1" < ./generated_data.sql #--quiet > /dev/null 2>&1
echo "injecting last trigger..."
psql "$1" < ./sql/heartrate_trigger.sql
echo "removing trash..."
rm generated_data.sql > /dev/null 2>&1
echo "finished!"