Switch to Postgres database

This commit is contained in:
Michał Gdula 2023-05-04 17:14:41 +03:00
parent fda3fcc28c
commit 5248ae0123
6 changed files with 67 additions and 19 deletions

View file

@ -0,0 +1,19 @@
#!/bin/sh
until pg_isready -d $DB_NAME -h $DB_HOST -p $DB_PORT -U $DB_USER
do
echo "Waiting for database to start... (5s)"
sleep 5
done
echo "Database is ready! Creating tables..."
flask --app server db init
if [ -n flask --app server db check ]; then
echo "Database changes detected! Migrating..."
flask --app server db migrate
flask --app server db upgrade
fi
echo "Starting server..."
gunicorn --bind highscore:8080 server:app