#!/bin/sh
# Brings the database up to date before the API starts (app/db_migrate.py
# "deploy": builds an empty one from db/schema.sql, applies pending
# migrations otherwise). MIGRATE_ON_START=false leaves that to a separate
# release step (`python -m app.db_migrate deploy`).
set -e
if [ "${MIGRATE_ON_START:-true}" = "true" ]; then
  python -m app.db_migrate deploy
fi
exec "$@"
