]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Creating table at init level for postgresql
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Thu, 26 Jun 2025 17:03:02 +0000 (13:03 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Thu, 26 Jun 2025 17:03:02 +0000 (13:03 -0400)
support/crdb.sh

index 694486d502f3e1a1db672a4dfa731c24f89ce39c..69cc58b4f6638b94e71730cfdccedbc26c719c68 100755 (executable)
@@ -59,6 +59,7 @@ case "$DB_TYPE" in
     ;;
   "POSTGRESQL"         )
     SQL="/usr/bin/psql -q"
+    MSQL="/usr/bin/psql -U $APPNAME -q $APPNAME"
     /etc/rc.d/init.d/postgresql status
     if [ $? != 0 ] ; then
       echo "Postgresql serveur NOT found up and running (exiting!)"
@@ -85,3 +86,7 @@ case "$DB_TYPE" in
     #undefined database type at that stage?
     ;;
   esac
+#loading database definition
+if [ -n "$MSQL" ] ; then
+  cpp -P -D$DB_TYPE /usr/share/$APPNAME/sql/$APPNAME.sql | $MSQL
+  fi