From 0e03681d82a0a0b0ae2b073a3361e9da942a0724 Mon Sep 17 00:00:00 2001 From: Kobe Date: Mon, 26 May 2025 22:08:20 +0200 Subject: [PATCH] Update entrypoint.sh --- entrypoint.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 385eb4b..609c951 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,12 +22,17 @@ until PGPASSWORD=$POSTGRES_PASSWORD psql -h db -U $POSTGRES_USER -d $POSTGRES_DB done echo "PostgreSQL is up - executing command" -# Remove existing migrations and create fresh ones -echo "Setting up fresh database migrations..." -rm -rf migrations -flask db init -flask db migrate -m "Initial migration" -flask db upgrade +# Run migrations if they exist, otherwise initialize them +echo "Checking database migrations..." +if [ -d "migrations" ]; then + echo "Running existing migrations..." + flask db upgrade +else + echo "Initializing new migrations..." + flask db init + flask db migrate -m "Initial migration" + flask db upgrade +fi # Create default site settings if they don't exist echo "Creating default site settings..."