#!/usr/bin/env bash
set -euo pipefail

ROOT="${APP_ROOT:-/app}"
MIGRATION_RUNNER="${ROOT}/scripts/run-migrations.sh"

if [[ -x "${MIGRATION_RUNNER}" ]]; then
  "${MIGRATION_RUNNER}"
else
  echo "⚠️  ${MIGRATION_RUNNER} not executable; skipping migrations." >&2
fi

exec "$@"
