-
Notifications
You must be signed in to change notification settings - Fork 73
/
add_server
executable file
·33 lines (25 loc) · 1.72 KB
/
add_server
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
27
28
29
30
31
32
33
#!/bin/bash -ex
# Temporary migration script for breaking down server level results
source ./config
RESULTPSQL="psql -h $RESULTHOST -U $RESULTUSER -p $RESULTPORT -d $RESULTDB"
mkdir -p results/$SERVERNAME
$RESULTPSQL -ef prequel.sql
$RESULTPSQL -c "UPDATE testset set server='${SERVERNAME}';"
$RESULTPSQL -c "UPDATE tests set server='${SERVERNAME}';"
$RESULTPSQL -c "UPDATE test_bgwriter set server='${SERVERNAME}';"
$RESULTPSQL -c "UPDATE test_statio set server='${SERVERNAME}';"
$RESULTPSQL -c "UPDATE timing set server='${SERVERNAME}';"
$RESULTPSQL -c "ALTER TABLE test_bgwriter ADD CONSTRAINT testfk FOREIGN KEY (server,test) REFERENCES tests (server,test) MATCH SIMPLE;"
$RESULTPSQL -c "ALTER TABLE test_stat_database ADD CONSTRAINT testfk FOREIGN KEY (server,test) REFERENCES tests (server,test) MATCH SIMPLE;"
$RESULTPSQL -c "ALTER TABLE test_statio ADD CONSTRAINT testfk FOREIGN KEY (server,test) REFERENCES tests (server,test) MATCH SIMPLE;"
$RESULTPSQL -c "ALTER TABLE timing ADD CONSTRAINT testfk FOREIGN KEY (server,test) REFERENCES tests (server,test) MATCH SIMPLE;"
$RESULTPSQL -c "ALTER TABLE tests ADD COLUMN start_latency timestamp default null;"
$RESULTPSQL -c "ALTER TABLE tests ADD COLUMN end_latency timestamp default null;"
$RESULTPSQL -c "UPDATE tests SET start_latency=start_time, end_latency=end_time;"
$RESULTPSQL -c "ALTER TABLE tests ADD COLUMN trans_latency int default null;"
$RESULTPSQL -c "UPDATE tests SET trans_latency=trans;"
$RESULTPSQL -c "ALTER TABLE tests ADD COLUMN server_version text default version();"
$RESULTPSQL -c "ALTER TABLE tests ADD COLUMN metrics jsonb;"
# This goes at the end because it's expected to return an error code,
# for trying to move a directory into itself
mv results/* results/$SERVERNAME/