#!/bin/sh set -e # Wait for database to be ready (if using external database) # For SQLite, this is not needed, but good practice for future database changes echo "Running database migrations..." # Use the DATABASE_URL from environment or default to SQLite if [ -z "$DATABASE_URL" ]; then export DATABASE_URL="file:/app/data/database.db" fi npx prisma migrate deploy echo "Checking if database needs seeding..." # Check if database file exists and has content if [ ! -f "/app/data/database.db" ] || [ ! -s "/app/data/database.db" ]; then echo "Database is empty or doesn't exist, seeding with sample data..." npx prisma db seed else echo "Database already exists with data, skipping seed..." fi echo "Starting application..." exec "$@"