#!/bin/bash

echo "Waiting for database..."
while ! nc -z db 5432; do
  sleep 0.1
done
echo "Database is ready!"

echo "Running database migrations..."
flask db upgrade

echo "Creating admin user..."
flask create-admin

echo "Starting application..."
exec "$@" 