feature: Adds forward creation.

This commit is contained in:
greysoh 2024-04-21 17:31:16 -04:00
parent c385d7b83b
commit b7b7f80308
No known key found for this signature in database
GPG key ID: FE0F173B8FC01571
6 changed files with 134 additions and 6 deletions

10
init.sh
View file

@ -5,14 +5,14 @@ if [ ! -d ".tmp" ]; then
mkdir .tmp
fi
lsof -i:5432 | grep postgres
lsof -i:5432 | grep postgres 2> /dev/null > /dev/null
IS_PG_RUNNING=$?
if [ ! -f ".tmp/ispginit" ]; then
if [[ "$IS_PG_RUNNING" == 0 ]]; then
kill -9 $(lsof -t -i:5432)
kill -9 $(lsof -t -i:5432) > /dev/null 2> /dev/null
fi
echo " - Database not initialized! Initializing database..."
mkdir .tmp/pglock
@ -21,10 +21,10 @@ if [ ! -f ".tmp/ispginit" ]; then
createdb -h localhost -p 5432 nextnet
psql -h localhost -p 5432 nextnet -c "CREATE ROLE nextnet WITH LOGIN SUPERUSER PASSWORD 'nextnet';"
npm install --save-dev
npx prisma migrate dev
touch .tmp/ispginit
elif [[ "$IS_PG_RUNNING" == 1 ]]; then
pg_ctl -D .tmp/db -l .tmp/logfile -o "--unix_socket_directories='$PWD/.tmp/pglock/'" start