Parcourir la source

Added init script for postgres.

Thomas Flucke il y a 7 ans
Parent
commit
b499c2b8b4
1 fichiers modifiés avec 14 ajouts et 0 suppressions
  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"