2022-11-20 07:37:22 -08:00
|
|
|
#! /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
|
|
|
|
|
2022-11-20 19:10:02 -08:00
|
|
|
# pg_ctl start -l $LOG_PATH -o "-c listen_addresses= -c unix_socket_directories=$PGHOST"
|
2022-11-20 07:37:22 -08:00
|
|
|
|
|
|
|
# TODO move to alembic migrations
|
|
|
|
psql $PGDATABASE << EOF
|
|
|
|
CREATE TABLE routes ( \
|
2022-11-23 05:26:58 -08:00
|
|
|
id text PRIMARY KEY,
|
2022-11-21 03:06:49 -08:00
|
|
|
name text,
|
2022-11-23 05:26:58 -08:00
|
|
|
"creatorName" text,
|
|
|
|
"creatorCharacter" int,
|
|
|
|
dustpoints jsonb[],
|
|
|
|
checkpoints jsonb[],
|
|
|
|
"startLocation" jsonb,
|
|
|
|
"endLocation" jsonb,
|
|
|
|
"creationDate" text
|
2022-11-20 07:37:22 -08:00
|
|
|
);
|