Add Flask Migrate and update run.sh

This commit is contained in:
Michał Gdula 2023-05-15 22:44:03 +03:00
parent 77c0711a24
commit 36be8993df
8 changed files with 37 additions and 30 deletions

View file

@ -1,19 +1,19 @@
#!/bin/sh
# # Check if migrastions folder exists
# if [ ! -d "/data/storage/migrations" ];
# then
# echo "Creating tables..."
# flask --app website db init
# fi
# Check if migrastions folder exists
if [ ! -d "/data/storage/migrations" ];
then
echo "Creating tables..."
flask --app website db init
fi
# # Check if there are any changes to the database
# if ! $(flask --app website db check | grep -q "No changes in schema detected.");
# then
# echo "Database changes detected! Migrating..."
# flask --app website db migrate
# flask --app website db upgrade
# fi
# Check if there are any changes to the database
if ! $(flask --app website db check | grep -q "No changes in schema detected.");
then
echo "Database changes detected! Migrating..."
flask --app website db migrate
flask --app website db upgrade
fi
# Start website!!!!
echo "Starting expo website..."