df-web/setup-postgres.sh
Anish Lakhwara 2819487f00 we have MVP
2022-11-23 23:26:58 +10:00

27 lines
608 B
Bash
Executable file

#! /usr/bin/env bash
# Run on the first time configuring database
if [ ! -d $PGHOST ]; then
mkdir -p $PGHOST
fi
if [ ! -d $PGDATA ]; then
echo 'Initializing postgresql database...'
initdb $PGDATA --auth=trust >/dev/null
fi
# pg_ctl start -l $LOG_PATH -o "-c listen_addresses= -c unix_socket_directories=$PGHOST"
# TODO move to alembic migrations
psql $PGDATABASE << EOF
CREATE TABLE routes ( \
id text PRIMARY KEY,
name text,
"creatorName" text,
"creatorCharacter" int,
dustpoints jsonb[],
checkpoints jsonb[],
"startLocation" jsonb,
"endLocation" jsonb,
"creationDate" text
);