#!/bin/bash
set -e

# Run the database readiness check
/app/wait-for-postgres.sh

echo "Setting up schema and inserting data..."
python apply_test_schema.py
python insert_csv_embeddings.py
echo "Database setup complete."

sleep 5
# Start the web server and keep it as the main process
exec uvicorn main:app --host 0.0.0.0 --port 8000