chore: Migrates development to use PostgreSQL instead.
This commit is contained in:
parent
2237568b92
commit
1ae93d71f6
12 changed files with 96 additions and 133 deletions
33
init.sh
Executable file
33
init.sh
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
if [ ! -d ".tmp" ]; then
|
||||
echo "Hello and welcome to the NextNet project! Please wait while I initialize things for you..."
|
||||
cp dev.env .env
|
||||
mkdir .tmp
|
||||
fi
|
||||
|
||||
lsof -i:5432 | grep postgres
|
||||
IS_PG_RUNNING=$?
|
||||
|
||||
if [ ! -f ".tmp/ispginit" ]; then
|
||||
if [[ "$IS_PG_RUNNING" == 0 ]]; then
|
||||
kill -9 $(lsof -t -i:5432)
|
||||
fi
|
||||
|
||||
echo " - Database not initialized! Initializing database..."
|
||||
mkdir .tmp/pglock
|
||||
|
||||
initdb -D .tmp/db
|
||||
pg_ctl -D .tmp/db -l .tmp/logfile -o "--unix_socket_directories='$PWD/.tmp/pglock/'" start
|
||||
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
|
||||
fi
|
||||
|
||||
source .env # Make sure we actually load correctly
|
Loading…
Add table
Add a link
Reference in a new issue