Skip to content

Commit 9364068

Browse files
authored
Update SetupDatabase.sh (#97)
* Update SetupDatabase.sh bugfix - missing `-ddaq` when setting up indices * Update SetupDatabase.sh missing subject specification on demo monitoring data
1 parent 49ed82a commit 9364068

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

SetupDatabase.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,17 @@ echo "creating monitoring table"
6363
psql -ddaq -c "create table monitoring (time timestamp with time zone NOT NULL, device text NOT NULL, subject text NOT NULL, data JSONB NOT NULL);"
6464

6565
echo "creating indices on device name and subject"
66-
psql -c "CREATE INDEX ON monitoring (device) WITH (deduplicate_items = on);"
66+
psql -ddaq -c "CREATE INDEX ON monitoring (device) WITH (deduplicate_items = on);"
6767
# this may be more efficient as we're unlikely to search by subject alone...
68-
psql -c "CREATE INDEX ON monitoring (device, subject) WITH (deduplicate_items = on);"
68+
psql -ddaq -c "CREATE INDEX ON monitoring (device, subject) WITH (deduplicate_items = on);"
6969

7070
echo "creating logging table"
7171
psql -ddaq -c "create table logging (time timestamp with time zone NOT NULL, device text NOT NULL, severity integer NOT NULL, message text NOT NULL);"
7272

7373
echo "creating indices on device name and message severity"
74-
psql -c "CREATE INDEX ON logging (device) WITH (deduplicate_items = on);"
74+
psql -ddaq -c "CREATE INDEX ON logging (device) WITH (deduplicate_items = on);"
7575
# as above. is anyone really going to want 'high priority logs from any device'? i doubt it
76-
psql -c "CREATE INDEX ON logging (device,severity) WITH (deduplicate_items = on);"
76+
psql -ddaq -c "CREATE INDEX ON logging (device,severity) WITH (deduplicate_items = on);"
7777

7878
echo "creating alarms table"
7979
psql -ddaq -c "create table alarms (time timestamp with time zone NOT NULL, device text NOT NULL, level integer NOT NULL, alarm text NOT NULL, silenced integer DEFAULT 0 );"
@@ -114,7 +114,7 @@ echo "Inserting a default user"
114114
psql -ddaq -c "INSERT INTO users (username, password_hash) VALUES ('dev_user', 'c20cc404fe15337ce6d8a5b782576d9a21de03f8707065c8ccf7abb1cc939801');"
115115

116116
echo "Inserting example monitoring data"
117-
psql -ddaq -c "INSERT INTO monitoring (time, device, data) SELECT now() - (i * INTERVAL '1 minute') AS time, 'test_device' AS device, jsonb_build_object( 'temperature', round((random() * 50 + 10)::numeric, 2), 'humidity', round((random() * 100)::numeric, 2)) AS data FROM generate_series(1, 100) i;"
117+
psql -ddaq -c "INSERT INTO monitoring (time, device, subject, data) SELECT now() - (i * INTERVAL '1 minute') AS time, 'test_device' AS device, 'general' AS subject, jsonb_build_object( 'temperature', round((random() * 50 + 10)::numeric, 2), 'humidity', round((random() * 100)::numeric, 2)) AS data FROM generate_series(1, 100) i;"
118118

119119
echo "Inserting example plotyplot data"
120120
psql -ddaq -c "INSERT INTO plotlyplots (name, time, version, traces, layout) VALUES ('plotly1', 'now()', 1, '[{\"x\": [1, 2, 3, 4, 5], \"y\": [10, 20, 15, 30, 25], \"type\": \"scatter\"}]', '{\"title\": \"plotly1\"}');"

0 commit comments

Comments
 (0)