#!/usr/bin/sh

HOST=${1:"localhost"}
# TODO: Prompt in terminal for password
PWD=${2:"ieat"}

BASE="$(basename "$0")"

# TODO: Auto detect existing DB and upgrade instead.

psql -u ieat -h "$HOST" -w "$PWD" < "$BASE/create.sql"
psql -u ieat -h "$HOST" -w "$PWD" < "$BASE/setup.sql"
psql -u ieat -h "$HOST" -w "$PWD" < "$BASE/load.sql"
psql -u ieat -h "$HOST" -w "$PWD" < "$BASE/load-ingredients.sql"
