#!/bin/bash
# Run sqlx migrations

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MAKIMA_DIR="$(dirname "${SCRIPT_DIR}")"

POSTGRES_CONNECTION_URI="${POSTGRES_CONNECTION_URI:-postgres://makima:makima_dev@localhost:5432/makima}"

echo "Running migrations from ${MAKIMA_DIR}/migrations..."
sqlx migrate run --source "${MAKIMA_DIR}/migrations" --database-url "${POSTGRES_CONNECTION_URI}"
echo "Migrations complete!"
