amex-2022-10-20/3_/mvp.sh

32 lines
611 B
Bash

#! /bin/bash
main() {
set -e
set -o pipefail
local bin=../0_setup/0_setup
local cmds=(
'DROP TABLE IF EXISTS events'
'
CREATE TABLE events (
sensor_id integer not null,
event_type integer not null
);
'
'INSERT INTO events VALUES (2, 2)'
'INSERT INTO events VALUES (2, 4)'
'INSERT INTO events VALUES (2, 2)'
'INSERT INTO events VALUES (3, 2)'
'INSERT INTO events VALUES (2, 3)'
"$@"
)
for cmd in "${cmds[@]}"; do
echo =================
$bin -q "$cmd"
echo
done
}
main "$@"