浏览代码

Added init script for postgres.

Thomas Flucke 7 年之前
父节点
当前提交
b499c2b8b4
共有 1 个文件被更改,包括 14 次插入0 次删除
  1. 14 0
      defs/sql/postgres/init-db.sh

+ 14 - 0
defs/sql/postgres/init-db.sh

@@ -0,0 +1,14 @@
+#!/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"