init-db.sh 400 B

1234567891011121314
  1. #!/usr/bin/sh
  2. HOST=${1:"localhost"}
  3. # TODO: Prompt in terminal for password
  4. PWD=${2:"ieat"}
  5. BASE="$(basename "$0")"
  6. # TODO: Auto detect existing DB and upgrade instead.
  7. psql -u ieat -h "$HOST" -w "$PWD" < "$BASE/create.sql"
  8. psql -u ieat -h "$HOST" -w "$PWD" < "$BASE/setup.sql"
  9. psql -u ieat -h "$HOST" -w "$PWD" < "$BASE/load.sql"
  10. psql -u ieat -h "$HOST" -w "$PWD" < "$BASE/load-ingredients.sql"