#!/bin/bash
set -e

echo "Starting application startup sequence..."

# Run migrations
echo "Running database migrations..."
uv run alembic upgrade head

# Optionally run seeders if RUN_SEEDERS environment variable is set
if [ "${RUN_SEEDERS:-false}" = "true" ]; then
    echo "Running database seeders..."
    uv run python -m app.core.seed
else
    echo "Skipping seeders (set RUN_SEEDERS=true to enable)"
fi

# Start the application
echo "Starting FastAPI application..."
exec "$@"

