#!/bin/bash set -e cd /app/murshid_backend # Run Alembic migrations echo "🔄 Running database migrations..." python -m alembic upgrade head echo "✅ Database ready" # Import Excel templates (if not already imported) echo "📊 Importing WQL templates from Excel..." python -c " from app.db.session import SessionLocal from scripts.import_excel_templates import run as import_excel db = SessionLocal() try: result = import_excel(db, replace=False) print('Templates:', result) finally: db.close() " || echo "⚠️ Template import skipped (non-critical)" echo "🚀 Starting Murshid API on port ${PORT:-7860}..." exec python -m uvicorn app.main:app \ --host 0.0.0.0 \ --port "${PORT:-7860}" \ --log-level info